a few words about web development

Granting User Connections From Remote Hosts to MariaDB on Debian 9

Another straight to the point solution
Once you have MariaDB server installed you might want to connect to it not only from localhost but also from different servers. In order do enable MariaDB to listen to remote connections you need
to do several things.

First, create a new user and grant him access to a database:
GRANT ALL ON MY_DATABASE_NAME.* TO MY_USERNAME@'MY_REMOTE_IP' IDENTIFIED BY 'MY_PASSWORD';
FLUSH PRIVILEGES;
Then allow incoming connections from MY_REMOTE_IP:3306 on your firewall:
/sbin/iptables -A INPUT -s MY_REMOTE_IP -p tcp --destination-port 3306 -j ACCEPT
iptables-save
Now edit MariaDB configuration file:
/etc/mysql/mariadb.conf.d/50-server.cnf
Find there section:
[mysqld]
and comment out line starting with:
bind-address
And then restart MariaDB server:
service mysqld restart

Comments

There are no comments yet