In Windows, MySQL executes SQL script files in batches recently for database migration. It is too difficult to manually execute MySQL script files in batches, so I wrote a script to share it. 01 @ echo off02: Specify the MySQL installation path 03D: 04cd D: \ MySQL Server 5.6 \ bin05: Database Name 06 @ set db = vp07 :: userName 08 @ set userName = root09: password 10 @ set password = root11: The SQL script to be executed 12 @ set sqlpath = E: \ 00. sql13: When you connect to the MySQL database and execute the SQL script-f script, if an error occurs, run -- default-character-set to specify the encoding of the imported data (the same as the database encoding) 14 mysql-f-u % userName % -- password = % password % db % <% sqlpath % -- default-character-set = gbk15: After the execution is complete, do not close dos window 16pause immediately. If you need to execute multiple script files 00. the SQL statement must be written in the following format: 1 source E: \ 01. sql2source E: \ 02. sql3source E: \ 03. sql4source E: \ 04. sql5source E: \ 05. SQL uses the source command to execute all scripts.