Mysql Remote access on plesk

edit /etc/my.cnf to show the following…

[mysqld]
port = 3306
# bind-address = 10.10.0.1
# skip-networking
....

Where,

* bind-address : local IP address to bind to. If you wish mysql listen on all IPs, don’t use this option.

* skip-networking : Don’t listen for TCP/IP connections at all. All interaction with mysqld must be made via Unix sockets. This option is highly recommended for systems where only local requests are allowed. Since you need to allow remote connection this line should be removed from file or put it in comment state.

Restart MySQL.

# service mysqld restart

Now you should grant access to remote IP address, login to Mysql:

# mysql -uadmin -p`cat /etc/psa/.psa.shadow` mysql

For example if you want to allow access to database called ‘foo’ for user ‘bar’ and remote IP 192.168.0.1(The IP you are connecting from) then you need to type following commands at “mysql” prompt:

mysql> GRANT ALL ON foo.* TO bar@'192.168.0.1' IDENTIFIED BY 'PASSWORD';

If you want to grant remote access for all databases to any IP:


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

Be sure to check that Iptables is set up with the info to allow the remote connection

# iptables -A INPUT -i eth0 -p tcp -m tcp --dport 3306 -j ACCEPT

To add to an existing database:

Other sources:
http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.