Reprint to http://my.oschina.net/u/660932/blog/117929
One
@echo off
Setlocal enabledelayedexpansion
:: Coder by Mark_li Powerd by IBAT 1.6
CD "C:\Program files\mysql\mysql Server 5.5\bin"
:: Database name
@set db=hrms
:: User Name
@set Username=root
:: Password
@set password=
:: SQL Script to execute
@set sqlpath= "C:\Program files\mysql\mysql Server 5.5\test_hrms.sql"
:: Connection to MySQL database and execute SQL script-F script execution, error continues execution--default-character-set Specifies the encoding of the imported data (same as database encoding)
Mysql-f-u%userName%--password=%password%%db% <%sqlpath%--DEFAULT-CHARACTER-SET=GBK
:: Do not close the DOS window immediately after execution is complete
Pause
Second, set the timeout command
Add under My.ini file
wait_timeout=2880000
Interactive_timeout = 2880000
Max_allowed_packet = 100M
Third, if you want to execute multiple SQL scripts
Replace Test_hrms.sql with source "C:\Program Files\mysql\mysql server 5.5\test_hrms.sql" "C:\Program files\mysql\mysql Server 5.5\test_hrms2.sql "
"C:\Program files\mysql\mysql Server 5.5\test_hrms3.sql"
Execute MySQL script file under Windows batch processing