For cPanel & WHM 11.48
(Home >> SQL Services >> Setup Remote MySQL Server)
This feature allows you to store your MySQL® databases on a remote server that runs MySQL. A separate server for MySQL is useful for busy servers or servers with large databases. You can offload MySQL-related work to the remote MySQL server.
This feature does not automatically transfer your MySQL data. Instead, it configures the remote server to work with your MySQL setup. After you configure the remote server, you must manually transfer your existing MySQL data. Any new databases that you create will exist on the remote MySQL server.
- Do not confuse this feature with the ability to allow access to a MySQL database from a remote server. To configure that option, use WHM's Additional MySQL Access Hosts interface (Home >> SQL Services >> Additional MySQL Access Hosts).
- We strongly recommend that each remote MySQL server correspond to a single cPanel & WHM server. While it is possible to use a single remote MySQL server for multiple cPanel & WHM servers, we do not recommend this configuration.
- Before you set up a remote MySQL server, ensure that you install the
openssh-clientspackage on your server. You cannot set up a remote MySQL server without this package.
Install openssh-clients package
To determine whether the
openssh-clients package exists on your server, run the following command:
If the package exists, the command produces the following output:
openssh-clients package does not exist, the command produces the following output:
To install the
openssh-clients package, run the following command as the
Make certain that the local server's hostname resolves
Whenever you change the server's hostname, you must use one of the following methods:
- Enter the new hostname in the Setup Networking section of WHM's Initial Setup Wizard interface.
- Use WHM's Change Hostname interface (Home >> Networking Setup >> Change Hostname).
- Call WHM API 1's
- Run the
/usr/local/cpanel/bin/set_hostnameutility as the
These methods ensure that all of the necessary system and service changes occur.
Before you set up a remote MySQL server, ensure that the remote server resolves your local server's IP address to its hostname. You must also ensure that the local server resolves your remote server's IP address to its hostname.
To confirm this, run the
host command on the remote server through the command line.
This command resolves the hostname from the IP address.
If you have not set up a reverse DNS entry for the local server, edit the
/etc/hosts file on the remote MySQL server and add an entry for your local server, with the IP address and hostname. This causes the server to perform the hostname lookup manually, rather than through the DNS.
Current MySQL Server
This section of the interface displays the current MySQL server.
If the server currently uses a remote MySQL server, and you wish to use the local server for MySQL databases, click Revert to "localhost".
Remote server setup
To set up a remote MySQL server, perform the following steps:
- If it is not already installed on your remote server, install MySQL.
- Add the MySQL user's
rootpassword for the
mysqluser to the
- Enter the remote server's address in the Remote Server Address text box.
- Enter the remote server's SSH port in the Remote SSH Port text box.
- Select whether you wish to log in to the remote server as the
rootuser or with a specific username.
- If you select User, enter the remote account's username and password in the text boxes that appear.
Select your desired authentication method.
You must specify whether to use a password or an SSH key to authenticate to the remote server.
- If you select Password, enter the password for the account in the Password text box.
- If you select SSH Public Key, select the key that you wish to use during authentication.
- If the SSH public key is encrypted, enter the key's passphrase in the SSH Key Passphrase text box.
- If you selected User under Login, select the desired Root Escalation Method option.
- If you select su, enter the
rootpassword in the Root Password text box.
- If you select su, enter the
- Click Setup MySQL.