Follow instructions below:
- Login to Plesk and make sure that
Allow remote connections from any host optionis enabled in Tools & Settings > Database Servers > Settings - Edit
my.cnf/my.inifile changingbind-addressparameter to:bind-address = 0.0.0.0Also, make thatskip-networkingparameter is not defined.For Linux:
/etc/mysql/my.cnfDebian/Ubuntu/etc/my.cnfCentOS/CloudLinux/RHELFor Windows:
"%plesk_dir%\MySQL\my.ini"for Plesk databases(port 8306)"%plesk_dir%\Databases\MySQL\my.ini"for Clients databases(port 3306)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
databasefor useruserwith passwordpasswordand remote IP address203.0.113.2:GRANT ALL ON database.* TO user@'203.0.113.2' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;To create a user that has access to all databases, execute the following query:GRANT ALL PRIVILEGES ON *.* TO 'someuser'@'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;
FLUSH PRIVILEGES;Note: to allow connections from any IP address use '%' character. - Make sure that MySQL server is listening on the correct IP address.For Windows:netstat -anp tcp | findstr 8306
TCP 0.0.0.0:8306 0.0.0.0:0 LISTENINGnetstat -anp tcp | findstr 3306
TCP 0.0.0.0:3306 0.0.0.0:0 LISTENINGFor Linux:# netstat -anp | grep :3306
tcp 0 0 203.0.113.10:3306 0.0.0.0:* LISTEN 13151/mysqld - Login from the remote server:mysql -u someuser -ppassword -h example.com