linux poison RSS
linux poison Email

Allow Remote Ronnections Acess to MySQL Server

MySQL by default allows you to connect to it via localhost, you can not connect to MySQL server directly from some remote IP address.

To enable remote mysql access you just need to perform a little editing in the mysql configuration file. Open the mysql configuration file -- /etc/mysql/my.cnf and look for line
bind-address =
Change the above line (Comment out) with following and save the changes
#bind-address =

Now, restart MySQL with the command:
sudo /etc/init.d/mysql restart
Now, login into mysql server (from command prompt) using root account using command:
mysql -u root -p
On successfull login, you will need to grant rights to a user so that the user has rights to perform DB activities from some IP address other than the server where your database is hosted (localhost).
grant all privileges on *.* to user@ identified by "password";
flush privileges;
*. is the database or databases that are authorized (* means all, but you can of course just choose one)
user is the MySQL username that you are granting remote access, is the IP Address of the remote server that you are granting access to (this can be replaced by * for ALL servers),
password is the password of the mysql user in question


Anonymous said...

Allowing from a local network host should be safe enough, assuming you have a hardware firewall protecting your network. But of course, you can and should also be use a local firewall (windows firewall, iptables etc...) to restrict access to specific hosts, as well as the mysql permissions.

Post a Comment

Related Posts with Thumbnails