How to move large sql file to new server

Normal method that I do:

1. From phpmyadmin, click on database, export, save as file, then download the file into my computer.

2. On new server, from phpmyadmin, import, browse to the file downloaded from #1

That is fine for small file. Even though it says 50Mb is OK, but it will depends on the connection speed as well. I tried 27Mb and it’s not working.

So I tried another method:

1. From cpanel on old server, click to backup wizard, click backup, pick mysql databases, select the table, then the download will start.

2. Using my FTP client, upload the *.gz from Step 1 to a folder on my new server. Any folder.

3. Login to SSH, use this command:

gzip -d database_file_name.gz

So it turns to:
database_file_name.sql

4. Then use this command to restore database:

mysql -u user -p new_database_name < database_file_name.sql

Please note that new_database_name is created in advance using phpmyadmin on new server.

Leave a Reply