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 = 127.0.0.1
Change the above line (Comment out) with following and save the changes
#bind-address = 127.0.0.1

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@192.68.1.1 identified by "password";
flush privileges;
Where:
*. 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,
192.168.1.1 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


1 comments:

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