Symptoms
- While adding external database server, the following error is received:
PLESK_ERROR: Host ‘server IP address’ is not allowed to connect to this MySQL server
OR
PLESK_ERROR: Error: Access denied for user ‘admin’@’mysql server IP’ to database
Cause
Connection to MySQL is allowed from localhost
by default. If Plesk should be connected to a remote MySQL server, it is needed to grant MySQL
user privileges to manage a database from specific IP address (from Plesk IP address).
admin
Resolution
-
Log in to MySQL database on the external database server using CLI:
# mysql -uroot -p -h 203.0.113.2
-
Check whether the admin user exists on the server:
MYSQL_LIN: mysql> select * from user where User=’admin’;
-
If such user exists, skip this step. If such user does not exist, create it:
MYSQL_LIN: mysql> CREATE USER ‘admin’@’plesk_server_IP’ IDENTIFIED BY ‘password’;
-
Run the following queries:
MYSQL_LIN: mysql> GRANT all ON . TO [email protected]’plesk_server_IP’;
mysql> FLUSH PRIVILEGES;Note: replace the username and password with the actual admin credentials and plesk_server_IP with actual Plesk IP address. Make sure that port 3306 is opened on the server that is running MySQL Server.