How to enable remote access to MySQL database server

Refers to:

  • Plesk

Created:

2016-11-16 12:41:14 UTC

Modified:

2017-02-27 20:26:27 UTC

4

Was this article helpful?


Have more questions?

Submit a request

How to enable remote access to MySQL database server

Question

How to enable remote access to MySQL database server?

Answer

MySQL users and databases are created in Plesk with permissions that allow access to the database externally. To enable remote access to MySQL, follow instructions:

  1. Login to Mysql Server:

    # mysql -uadmin -p
  2. Grant access to remote IP address and login to MySQL. For example, if you want to allow access to database called database for user user with password user-password-here and remote IP address 10.10.0.2 , do the following:

    mysql> GRANT ALL ON database.* TO user@'10.10.0.2' IDENTIFIED BY 'user-password-here';
    mysql> FLUSH PRIVILEGES;

IP can be replaced with % to allow this user to logon from any host or IP.

  1. If connection still fails, check "bind-address" option in /etc/my.cnf or /etc/mysql/my.cnf files.

*bind-address * option is IP address to bind to.

Have more questions? Submit a request
Please sign in to leave a comment.