mysql connect to different server, replace localhost with ip address or server name?


Nov 19, 2013
cPanel Access Level
Reseller Owner
I am moving a number of ecommerce sites to a new server, I do not want to put them all off line on the old server, I would rather they a linked with the new database (so new usernames etc are collected in the new database).
or people who have the old IP address stuck in their cache are automatically directed to the new IP which I do not think is a possibility.

I see that I can give access to my old server IP address to access my MySQL on my new cpanel.
But I do not know if simply changing localhost to the ip address of my new host will work, I have not tested it but I think not? maybe there is a server name that can be used?

I am using zencart. After I have given access to the old host IP address, is there anything I can use in here
define('DB_SERVER', 'localhost');


Staff member
Apr 11, 2011
Hello :)

You can import the databases and database users into the new server and then setup a remote MySQL server on the source server via:

"WHM Home » SQL Services » Setup Remote MySQL Server"

Documentation on this feature is available at:

Setup Remote MySQL Server

Thank you.