Recently while restoring database from a large backup file I encountered some common MySQL issues and a quick search on google helped me in resolving them.
So for reference I am posting the steps for resolving these issues on windows :
1. For starting restore, issue the following command from command prompt:
mysql –u root –p > [sql file path]
After this you will be prompted for root account’s password. On entering root account’s password server will start to restore the database from the backup. However if mysql server’s configuration has not been adjusted to handle large backups then you will soon see a similar message:
Error 2006: MySQL server has gone away.
2. Locate ‘my.ini’ file on your system. On Windows XP the default location is:
‘<Drive Letter>:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server <version>’
For Windows 7 the default location is:
‘<Drive Letter>:\ProgramData\MySQL\MySQL Server <version>’
3. Stop MySQL service.
Generally MySQL is installed as a service on windows. So open services window (use ‘services.msc‘ command on windows run dialog) and stop the required service.
4. Open my.ini file and add the following:
max_allowed_packet = <Size>M
wait_timeout = <time in seconds>
Save the file and restart MySQL server by starting the stopped service.
Now restart database restoration as described in step 1.
If the error still persists then keep on changing the values as described in step 4.
Following are some links for reference: