Mysql – How to load large SQL file into thesql

databasedatabase-administrationMySQLwindows 7

I have a database backup of a MySQL database that is about 250MB. I made it with mysqldump

I was trying to load it on another server like so:

mysql -u xxxx -pxxxx data_mirror < dbdump.sql

I was not satisfied with this process because

  1. It did not give me any feedback on the (lengthy) progress
  2. It failed with a "Server went away" message

What method would you recommend for backing up and restoring large MySQL database?

I am doing this on Windows 7 – based servers.

Best Answer

The reason you got a "Server went away" is because your terminal session timed out. Use nohup to prevent the process from being interrupted, like so:

nohup mysql -u xxxx -pxxxx data_mirror < dbdump.sql &

Note: the ampersand means the process runs in the background. To track the state of the running process, simply tail the nohup.out file that gets created:

tail -f nohup.out