PDA

View Full Version : Remote MySQL Access in Linux



aaronbrad
04-11-2016, 04:41 AM
We can enable remote access to MySQL by doing some small changes.

Edit MySQL configuration file /etc/my.cnf and comment out following parameters


#bind-address = 127.0.0.1
#skip-networking


Restart the MySQL service.

Now you will require to assign privilege to the database user and database for remote access. Use below query in mysql terminal


GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'@'xx.xx.xx.xx' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;

Here access is allowed to IP xx.xx.xx.xx you can replace it with % symbol to provide access to all IPs.

Then flush the privileges


FLUSH PRIVILEGES;

Now exit from the mysql terminal. Now you should be able to access the database remotely.