Prerequisites

  • Credentials to access the Plesk panel
  • SSH root access 


Implementation

Follow the below steps to install MySQL, Enable remote access to the local MySQL server, and Proxy rule setup in the Plesk panel
I. MySQL installation

  1. Log into Plesk with the credentials
  2. Go to Tools & Settings > Database Servers > Add database server .
  3. Select MySQL in Database server type, specify a Hostname or IP address, Port number, and Authentication data of another MySQL server.
    Click on OK.
    Note: By default, the Administrator’s username for the additional MySQL server is root.
  1. Verify the MySQL successful  installation in Tools & Settings > Database Servers 

II. Enable remote access to the local MySQL server

1. Go to Tools & Settings > Database Servers > Settings > click Local MySQL Settings

2. Select the Allow local MySQL server to accept external connections checkbox, and then click OK

3. Connect to a Plesk server via SSH and open the MySQL configuration file in any text editor. Location of this file is

For CentOS/RHEL-based distributions:
/etc/my.cnf

For Debian/Ubuntu-based distributions:
/etc/mysql/my.cnf

4. Change the bind-address parameter to:

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 a specific IP address, specify this particular IP instead of 0.0.0.0

Also, make sure that the skip-networking parameter is not defined.

  1. After that, restart the MySQL server
    For CentOS/RHEL-based distributions:
    # service MariaDB restart
    For Debian/Ubuntu-based distributions:
    # service mysql restart
  1. Login to the Mysql server with the credentials that you have created in the previous steps
  1. Grant access to remote IP address and login to MySQL.
    For example, if it’s required to  allow access to the database called database for user with password and remote IP address
GRANT ALL ON database.* TO user@’%’ IDENTIFIED BY ‘password’;
CONFIG_TEXT: FLUSH PRIVILEGES;


Note: Replace the % with specific IP if needed.

To create a user that has access to all databases, execute the following query:
GRANT ALL PRIVILEGES…

III. Proxy rule setup 

  1. Login to the Plesk panel
  2. Navigate to Domain, select the domain which needs to add a proxy pass
  3. Select Hosting & DNS > Apache &nginx settings
  4.  Add the rules in the section Additional directives for HTTP & Additional directives for HTTPS. Click on OK

    Additional directives for HTTP
SSLProxyEngine on
ProxyPass / http://hostname.plesk.page:8880/phpMyAdmin/
ProxyPassReverse / http://hostname.plesk.page:8880/phpMyAdmin/


Additional directives for HTTPS

SSLProxyEngine on
ProxyPass / http://hostname.plesk.page:8880/phpMyAdmin/
ProxyPassReverse / https://hostname.plesk.page:8880/phpMyAdmin/

5. We can access the phpMyAdmin with the URL mentioned below
https://domainname

Leave a Reply