Running MySQL on remote server

I have followed steps on,running_mysql_on_a_remote_system/#running_mysql_on_a_remote_system to configure MySQL to run on another server. Two servers are located next to each other, but communicate with each other through local LAN. Now I am trying to make them work directly with each other. Both of the servers are connected to LAN through eth0. I’ve connected two servers with each other through eth1 with regular ethernet cat6 cable, but not sure how to set up the connection and will this way work at all. Both servers have CentOS 6.4 based Webmin, firewalls managed by APF. Could anyone elaborate what should by my next steps? Thanks!

(Deleted duplicate due to web server error)

The documentation you linked seems quite extensive and explains the process very well. I wouldn’t know what to say besides repeating what’s said there. :slight_smile: So did you follow those steps? Where exactly did you run into what problems?

The documentation is indeed comprehensive on software configuration part, but please re-read my post - I am trying to make needed configuration on hardware part. The documentation is well explained how to connect to ANY REMOTE MySQL server, whereas in our case two servers are located next to each other, they are not as REMOTE and can be connected directly to each other. They are currently are communication through LAN, but why not to connect them directly to each other as both of them have extra ethernet ports. I just need to figure out how to make requests from main server for MySQL databases go through eth1 instead of eth0.

(Duplicate deleted due to web server error. Eric, could you please check that? Since a few days, when I make posts from my tablet with Dolphin, I get a webserver error and my post is created twice.)

Ah okay, so your topic is a bit misleading, since it’s not about the MySQL part specifically. :wink:

Before I write a whole essay about how to connect two servers, can you please elaborate what your problem about that is exactly? Normally, you just connect them with a cable and configure the NICs with a separate IP network etc., set the routing properly, and the rest, like choice of correct interface, works automatically.

My problem is I never did this before and googling gives vast volume of various resources, but not exactly what I am looking for. So I thought since some Virtualmin users move their MySQL database on a separate server, then someone definitely walked the path that I am trying now and could share some recommendations. The steps you described is exactly the solution I am looking for:

connect them with a cable and configure the NICs with a separate IP network etc., set the routing properly, and the rest, like choice of correct interface

I will try now dig about these steps in the net to find more detailed instructions, but would appreciate if you can give more detailed instructions. Thanks!

Your endeavor is really independent from MySQL, since connecting two servers directly, while both are also connected to the Internet separately, can be done for a lot of purposes.

As for details, well you’d use the Webmin networking config module to configure the second NIC in both servers just like you configure the primary one. You’d give the servers private IP addresses on those NICs, e.g. and, and set the mask to /24 or for both. Gateway and nameserver are not required, since they are not connected to the outside network on those NICs. That should have the system automatically create the proper routing table entries.

Then you’d use the private IP whenever server 1 needs to talk to server 2 directly, and vice versa. E.g. when you have a web software installed on server 1 which needs to talk to MySQL on server 2, you’d use “” as MySQL IP instead of server 2’s external IP. Then the traffic will automatically go through the correct interface.

This is more than enough, I will try to experiment later today. Thank you very much!