WHM 11 services series

31. How to set your WHM server to use a remote MySQL server

If your users will be running database-heavy applications, or if you have many servers, perhaps you'd like to consolidate your MySQL databases all onto one server.

In order to do that, you will need to instruct cPanel/WHM to use a remote MySQL server.

1) Go to the SQL Services menu.

2) Proceed to Setup Remote MySQL server.

As you can see, our current MySQL server is localhost.

3) Let's change that. Start with the server's hostname or IP.

4) Ensure that the Remote SSH port is correct.

5) Next, we need to fill in the Authentication information. What you need to enter depends on how the server in question is set up.

If your server is set up to block direct root SSH access -- which is best, for security purposes -- you'll need to specify the name of an admin user on the system that can switch users to root.

6) Choose the correct authentication method, and fill in a password for the user. If you'll be using Public Key SSH access, you'll need to select or add an SSH key and enter its password, if required.

7) Then, choose the correct root escalation method. If you'll be using su, you'll need to also enter the server's root password.

8) If, on the other hand, you'll be using direct root SSH access, click the button next to Root.

The form will update to reflect the change.

9) We'll change our authentication method to Password.

10) Enter the Root Password for the server.

11) When finished here, click Setup.

It may take a minute or two for the Remote MySQL Host to be set up properly.

If successful, you'll see that some configuration files have been updated, followed by the success message shown in bold.

You may need to reset your MySQL password in WHM in order for the remote server to work. Check the tutorial in this series to see how it's done.

12) Return to the setup page.

As you can see, our Current MySQL Server has changed to alpha.demosite.com.

If you intend to keep using Remote MySQL, you'll need to read the message in the grey background above and ensure that the correct steps are taken, if necessary. That's beyond the scope of this tutorial, however.

Now, let's see how to switch our system back to using a local MySQL server.

13) Enter localhost for the server address.

14) Skip all the rest of the settings and click Setup.

The local MySQL server will now be used again. As before, you may need to reset your password in order for it to work; you can do so using this link, or watch the aforementioned tutorial for details.

This completes the tutorial. You now know how to set your WHM server to use a remote MySQL server, and how to change it back to using the local server.