How to grant remote access to MariaDB Server on Debian 9 Stretch

grant remote access to MariaDB Server on Debian 9

MySQL Server (MariaDB) remote access is disabled by default. With little tweak we can easily enable or grant remote access to MySQL Server. I am running MariaDB on my Debian 9 server. You may use this tutorial on other distribution with little modifications. Initially I could not connect to my remote MySQL Server from my backup software. If this is your case, you will need to enable remote access to the MySQL Server.

grant remote access to MariaDB Server on Debian 9

Note:

Before you continue, I am using Debian 9 to host my MariaDB Server. I will show you how to edit the MariaDB configuration file on Debian 9. This configuration file might be different for some other distributions. 

Steps to grant remote access to MariaDB Server on Debian 9

Step 1. Locate the correct .cnf file

Ok, first go to /etc/mysql/ directory and look for mariadb.conf.d directory you should see the following configuration files listed there.

50-client.cnf  50-mysql-clients.cnf  50-mysqld_safe.cnf  50-server.cnf

Step 2. Edit 50-server.cnf file

Now we want to make some edit to the file 50-server.cnf

nano 50-server.cnf

Now scroll down and find the following line:

bind-address           = 127.0.0.1

We need to comment this line to enable remote access to our MariaDB Server. So now it should looks like this:

#bind-address           = 127.0.0.1

Now close and save the file.

Step 3. Restart MySQL Server service

We need to restart MySQL Service afterward

systemctl restart mysql

Done. Now we can try to connect to our MariaDB Server from other computer. It should works by now.

Additional Step

If you want to connect to your MySQL Database from remote computer, make sure your user is capable to do this remote access. If not, we need to create a new user or modify it so the user can access from any hosts.

#Login to MySQL Console
mysql -u root -p
Enter password:
#Modify user
GRANT ALL PRIVILEGES ON *.* TO 'dhani'@'%' IDENTIFIED BY '12345678';
FLUSH PRIVILEGES
EXIT;

Thanks for reading this tutorial how to grant remote access to MariaDB Server on Debian 9. See you on the next tutorial.

2 Trackbacks / Pingbacks

  1. Connect MySQL Server on HeidiSQL - Free MySQL Guide
  2. How to Install MariaDB Server on Debian 9 Stretch

Leave a Reply

Your email address will not be published.


*