Import large .sql file into MySQL
Increasing the wait_timeout
and/or interactive_timeout
should help. First check the current value:
C:\> mysql -hlocalhost -uroot -proot
mysql> SHOW VARIABLES LIKE 'wait_timeout';
If this is very low (e.g. 30 seconds) then increase it (e.g. 5 minutes):
mysql> SET SESSION wait_timeout = 300;
mysql> SET SESSION interactive_timeout = 300;
Then execute your SQL file:
mysql> \. database.sql
I had a 3.5G dump file, I tried to import it with PhpMyAdmin and MySql workbench but without success. So I just used the console to run it
# mysql -u user_name -pYour_passwd your_db < your_dump.sql
and it works great