This blog is subject the DISCLAIMER below.

Sunday, November 02, 2008

Enabling remote access to Mysql

A very common problem when using Mysql is when you try to remotely connect to the server, the solution is very simple and direct.

Configuration:
1- find a file named "my.cnf", this file contains the server configurations.
2- if you find a line with this syntax "skip-networking", comment it by putting a "#" in the begining of the line.
3- if you find a line with this syntax: bind-address = 127.0.0.1, comment it as well, this line tells mysql to accept connections only from localhost.

Persmissions:
now, you have to tell mysql who is to access the server with what permissions
1- login to mysql(example using root user name) : mysql -uroot -p
2- suppose that the data base we need to make available is named koko, so to make koko available to root with password 'password' at the machine with address 192.168.1.5 we write:
GRANT ALL on koko.* TO 'root'@'192.168.1.5' IDENTIFIED BY 'password';
3- then write : FLUSH PRIVILEGES;

Note: do not forget to restart mysql to reload configurations in the my.cnf file.

No comments: