1、打开mysql命令窗口
source test.sql
source 不带分号
执行多个脚本1、待执行的sql文件为test1.sql、test2.sql、test.sql、4.sql等
2、写一个总的sql文件例如:all.sql文件:
source test1.sql
source test2.sql
source test3.sql
source test4.sql
3、在mysql下执行
source batch.sql
注意sql路径问题以及mysql 的版本,博主使用的是5.7,注意不要分号
直接窗口运行【Mysql的bin目录】\mysql –u用户名 –p密码 –D数据库<【sql脚本文件路径全名】
D:\MySQL\bin\mysql –uroot –p123456 -Dtest<C:\test.sql