Product:
Search Type:

How do I enable remote access to MySQL database server?

Article ID: 1134 
Last Review: May,10 2007
APPLIES TO:
  • Plesk for Linux/Unix

RESOLUTION

Since Plesk 8 MySQL users and databases are created with permissions that allow access to the database from outside. In previous Plesk versions MySQL users and databases are created with permissions that allow to access the database from localhost only. However, sometimes you need to provide the remote access.

Open /etc/my.cnf and make sure that the following lines exists/commented in [mysqld] section:

[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. 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 then you need to type following commands at "mysql>" prompt:

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


Please provide feedback on this article

Did this article help you solve your issue?
Yes
No
Partially
I do not know yet
 
Strongly Agree   Strongly Disagree
  9 8 7 6 5 4 3 2 1
The article is easy to understand
The article is accurate
Additional Comments:
*Please provide us with your email address in case we need to contact you.
*Please type the code you can see.
* - required fields