Page tree
Skip to end of metadata
Go to start of metadata

 

For cPanel & WHM version 11.50

(Home >> SQL Services >> Setup Remote MySQL Server)

Overview

This feature allows you to store your MySQL® databases on a remote server that runs MySQL. Remote MySQL servers can reduce the load that large databases produce on busy local servers. You can offload MySQL-related work to the remote MySQL server.

Any new databases that you create exist on the remote MySQL server. However, this feature does not automatically transfer your MySQL data. Instead, it configures the remote server to work with your local MySQL setup. After you configure the remote server, you must manually transfer your local MySQL data.

Important:

  • Do not confuse this feature with the ability to allow a remote server to access a local MySQL database. 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 you can 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, confirm that the openssh-clients package exists on your local 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 local server, run the following command:

rpm -q openssh-clients 

If the package exists, the command produces output that resembles the following example:

openssh-clients-5.3p1-81.el6_3.x86_64

If the openssh-clients package does not exist, the command produces output that resembles the following example:

package openssh-clients is not installed.

To install the openssh-clients package, run the following command as the root user:

yum install openssh-clients

Make certain that the local server's hostname resolves

Note:

Whenever you change the server's hostname, you must use one of the following methods: 

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 IP command, where IP represents the remote server's IP address. This command resolves the hostname from the IP address.

The command's output will resemble the following example:

20.0.168.192.in-addr.arpa domain name pointer host.example.com. 

If you have not set up a reverse DNS entry for the local server, perform the following steps:

  1. Open the /etc/hosts file on the remote MySQL server with a text editor.
  2. Add an entry for your local server that includes the IP address and hostname and resembles the following example:

    192.168.0.20 host.example.com 

    This action causes the server to perform the hostname lookup manually, rather than through DNS.

  3. Confirm that the IP address that you added to the /etc/hosts file resolves correctly. To do this, run the ping IP command, where IP represents the remote server's IP address.

Current MySQL Server

This section of the interface displays the current MySQL server.

If the server currently uses a remote MySQL server, and you want 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:

  1. Install MySQL if it does not already exist on your local server.

  2. Add the MySQL root password for the mysql user to the /root/.my.cnf file. The code block will resemble the following example, where yourpassword represents the root user's password:

    [client]
    user=root
    password=yourpassword
  3. If present, remove or comment out the skip-name-resolve setting from the /etc/my.cnf file.

    Warning:

    If you do not remove the skip-name-resolve setting, the system may not allow you to transfer the current MySQL account to the remote MySQL server.

  4. Enter the remote server's address in the Remote Server Address text box.
  5. Enter the remote server's SSH port in the Remote SSH Port text box.
  6. Select whether to log in to the remote server as the root user or with a specific username.
    • If you select User, enter the remote account's username and password in the text boxes that appear.
  7. Select your desired authentication method.

    Note:

    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 want to use during authentication.
      • If the SSH public key is encrypted, enter the key's passphrase in the SSH Key Passphrase text box.
  8. If you selected User under Login, select the desired Root Escalation Method option.
    • If you select su, enter the root password in the Root Password text box.
  9. Click Setup MySQL.
  10. Shut down the local MySQL service in WHM's Service Manager interface (Home >> Service Configuration >> Service Manager).

    Important:

    If you do not perform this final step, the system may handle the database data incorrectly.