Welcome to WebmasterWorld Guest from

Forum Moderators: phranque

Message Too Old, No Replies

Moving a MySQL database to a different server

How can I move my database from one server to another one?

6:36 am on Sep 20, 2006 (gmt 0)

10+ Year Member


I'm moving a site from one server to another one, and I can't work out how to move the MySQL database.

I thought I would be able to use phpMyAdmin to back it up from the server A and then restore it to server B but that doesn't work.

Any help or advice would be much appreciated.

6:44 am on Sep 20, 2006 (gmt 0)

10+ Year Member

1.) service mysql stop
2.) rsync -e ssh -avz /var/lib/mysql/database_name/ user@server.ip:/var/lib/mysql/database_name/
3.) server mysql start

==> your DB will be ready on the new server with IP=server.ip

7:17 am on Sep 20, 2006 (gmt 0)

10+ Year Member

Thanks freeflight2, but I don't think I have the access needed to do it that way.

Both sites are on shared hosting so I think I'm limited to what I can do with phpMyAdmin and/or FTP.

7:42 am on Sep 20, 2006 (gmt 0)

10+ Year Member

then just copy the db directory via FTP
8:04 am on Sep 20, 2006 (gmt 0)

10+ Year Member

Not sure why it isn't working, are you getting any error messages? I presume you are exporting via phpmyadmin?
2:01 pm on Sep 22, 2006 (gmt 0)

10+ Year Member

I'm sorry but I've just been through the process again so I can describe what's happening and it worked, even though I tried it twice before and it didn't.

This is what I'm doing:

1. On xyz.com I use phpMyAdmin to export the database xyz_xyz as a gzip compressed file to my PC drive.

2. On abc.co.uk I create an empty database abc_abc and use phpMyAdmin to import the compressed file.

Anyway it's all working now so I'm sorry for the false alarm but thanks for all your help.