Setting up dedicated Server with cPanel and a remote MySQL server

Setting up dedicated Server with cPanel and a remote MySQL server

0 13260
Setting up dedicated Server with cPanel and a remote MySQL server

Setting up dedicated Server with cPanel and a remote MySQL server

Let’s assume that you are running database-heavy web applications or you’ve got a lot of servers. In this time it is very possible that you think about consolidation your MySQL databases all onto one server. Using a separate server for MySQL can be very useful for you in case if you have had busy servers or servers with large databases. So you can offload MySQL-related work to the remote MySQL server. In our tutorial you can read how to setup your servers and connect your projects to remote MySQL server.

The whole process is very easy. Before you begin, make sure about these things:

  1. A domain name (like domain.com), and that all your MX records are setup correctly at your domain provider.
  2. Make sure you have two dedicated servers
  3. Make sure the server’s hostname is FQDN. That mean that you must have a legit name on your server. One example for a legit name is “server.mysql.com” and one example for non-legit name “Ireally_hate_f**_mysql.crap.com”
  4. Two IP addresses. One for each server.
  5. Clean CentOS installation on each server. Clean installation means that nothing should be installed only CentOS. But both servers need to be reached with SSH.

When all this things are ready, you should go to this address:

https://www.buycpanel.com

BuycPanel

and order two cPanel licenses. You will get an account there. Note that when you order both cPanel licenses, you need to give them Ip-addresses for both your servers. You must also give them your root password so they can access them with SSH.

You can now choose to pay with creditcard or PayPal.

As usual single cPanel license costs $38 each month. You can (if you are lucky) find a special code online. That code will give you the cPanel license for $35 each month.

After you have paid for each license, you go into your cPanel account. Go to Client Area and click on “Request cPanel Installation”

Do it for both the servers.

The BuycPanel staff will not install for free cPanel on both your servers.

The process will take c.a. 3 hours for each server.

You will get one email when the process starts, and when it is complete.

You will also get all login details to your cPanel.

NOTE!

For the server one, you will need to give them the correct FQDN on the first server. For the second server, you tell them that you will use the same FQDN.

Why? All because the second server shall never go online on internet with. It will only act as your remote MySQL server.

After all this, you have two servers set up and fully working with MySQL, Apache and everything. The BuycPanel staff have fixed everything for you!!

We go further

Before we continue, make sure you have the latest version of PHP installed on the server you will use to work on, and the newest MySQL version (version 5.5) on the server you shall use as remote MySQL server.

This is not a cPanel tutorial and there is lot of guids about this, but for upgrading to latest MySQL version, login to cPanel as root, scroll down to Software section on left side. Click on “MySQL upgrade” and follow the text on screen.

After that you have to wait until this 8 steps are complete. NOTE! That Apache and PHP also will be re-compliled during this process.

After this, you are ready to continue.

Login as root with cPanel on the first server (not the remote MySQL server).

Scroll down to SQL Services on left side. Click on “Setup Remote MySQL server”.

Setup Remote MySQL server

Here you need to fill in IP address to the second server, the root login password for access to root on that server (choose password login in this section).

After this is done, click on the button and everything is set up for you in 1-2-3.

You are DONE!!

If you now want to access and use MySQL on the server you are working on, you can not use “localhost” when you try to establish a MySQL connection in PHP. Instead of “localhost” you have to set the IP address for the MySQL server.

After this – and every time you login – and use phpMyAdmin – you will get access automatically to the remote MySQL server.

It can’t be easier :)


Note!

After all the setups are done, remember to restart your servers. And also hardening the security on both servers. This is not a part of this tutorial, but never forget to harden the servers.

You can also tweak things directly from cPanel, so you don’t have to think about logging in with SSH to do this things.


NO COMMENTS

Leave a Reply