How to allow remote connection to mysql

posted in: Linux | 0

First login to your MySQL server

sudo mysql -u USERNAME -p

Next grant privilege make sure and use your own password

GRANT ALL PRIVILEGES ON *.* TO ‘root’@’%’ IDENTIFIED BY ‘PASSWORD’ WITH GRANT OPTION;
FLUSH PRIVILEGES;

****** If you copy and paste the above line you may need to replace the ‘ single quote with one you type from the keyboard. ******

And then find the following line and comment it out in your my.cnf or mysqld.cnf file, which should be here /etc/mysql/my.cnf if it is not this file may direct you to the correct location scroll tot he bottom of the file. In some cases the location for the file is /etc/mysql/mysql.conf.d/mysqld.cnf).

Change line

 bind-address = 127.0.0.1

to

 #bind-address = 127.0.0.1

 

Then restart your SQL server

service mysql restart