How to enable MySQL/MariaDB remote access

Out of the box, MySQL will only allow access from the localhost address 127.0.0.1. To change this, you need to open the /etc/mysql/mysql.conf.d/mysqld.cnf (mariadb–> /etc/mysql/my.cnf) file and change the line:

~$ sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

bind-address = 127.0.0.1

to:

bind-address = 0.0.0.0

Save and close that file.

~$ sudo -u root -p

command this:

GRANT ALL PRIVILEGES ON *.* TO ‘root’@’%’ IDENTIFIED BY ‘password’;

Restart the MySQL server with the command:

~$ sudo systemctl restart mysql.service

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.