- Plesk 12.0 for Linux
- Plesk 12.5 for Linux
- Plesk Onyx for Linux
- Plesk Onyx for Windows
How to enable a remote access to a MySQL database server?
Warning: After enabling the access, all MySQL connections will be unencrypted. To make them encrypted, you require SSL certificate and additional steps: https://dev.mysql.com/doc/refman/5.7/en/using-encrypted-connections.html#using-encrypted-connections-server-side-configuration
By default, Plesk administrator does not have a remote access. It is recommended to create a new user that will be used for the remote connection. However, you can do it for admin user also.
In order to enable remote access to a MySQL server, connect to the server via SSH/RDP and follow instructions below:
Automatic Solution for Plesk Onyx on Linux (Recommended)
Download, unzip and run automatic script.
# wget https://support.plesk.com/hc/article_attachments/360002519874/remotemysql.zip
# unzip remotemysql.zip
# chmod +x remotemysql
Note: The remote access will be granted to 'admin' user. If it is required to give an access to another user, follow also the step 6 from the solution below.
Manual solution for Plesk 12.* and Plesk Onyx
- Login to Plesk and make sure the option Allow remote connections from any host is enabled at Tools & Settings > Database Servers > Settings.
for CentOS/RHEL-based distributions:
- for Debian/Ubuntu-based distributions:
CONFIG_TEXT: bind-address = 0.0.0.0
Note: 0.0.0.0 means every IP address on the server. If it is required to bind to specific IP address, specify this particular IP instead of 0.0.0.0
Also, make sure that
skip-networkingparameter is not defined.
- After that, restart MySQL server.
Note: For the access to client's MySQL server on Windows, use PHPMyAdmin: Plesk > Tools & Settings > Database Servers - MySQL DB Admin.
Grant the access to remote IP address and login to MySQL. For example, if you want to allow access to database called
passwordand remote IP address
CONFIG_TEXT: GRANT ALL ON database.* TO [email protected]'203.0.113.2' IDENTIFIED BY 'password';
CONFIG_TEXT: FLUSH PRIVILEGES;
To create a user that has access to all databases, execute the following query:
CONFIG_TEXT: GRANT ALL PRIVILEGES ON *.* TO 'user'@'203.0.113.2' IDENTIFIED BY 'password' REQUIRE NONE WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;
CONFIG_TEXT: FLUSH PRIVILEGES;
Note: to allow connections from any IP address use '
Make sure that MySQL server is listening on the correct IP address.
C:\> netstat -anp tcp | findstr 8306
TCP 0.0.0.0:8306 0.0.0.0:0 LISTENING
C:\> netstat -anp tcp | findstr 3306
TCP 0.0.0.0:3306 0.0.0.0:0 LISTENING
# netstat -anp | grep :3306
tcp 0 0 203.0.113.10:3306 0.0.0.0:* LISTEN 13151/mysqld
Login from the remote server:
CONFIG_TEXT: mysql -u someuser -p "password" -h example.com
Video instruction for Linux
In order to allow remote access to MySQL database server in Plesk for a specific user, follow the steps below:
- Go to Plesk > Subscriptions > example.com > Databases > User Management > example_db_user;
- Make sure that Access control is set to Allow remote connections from any host or to Allow remote connections from:
- Login to MySQL database server from another server remotely by executing the following command:
# mysql -u "example_db_user" -p "password" -h "example.com"
Note: If the remote connection cannot be established check firewall settings - the required port possibly is blocked.