一切福田,不離方寸,從心而覓,感無不通。

Windows批处理执行sql脚本/语句

脚本

SET dbhost=127.0.0.1
SET dbuser=root
SET dbpasswd=xxxx
SET dbName=dbnamexx
SET sqlpath=./
set sqlfile=statistics_fee_data_sync.sql

mysql -h%dbhost% -u%dbuser% -p%dbpasswd% --database=%dbName% < %sqlpath%%sqlfile% --default-character-set=utf8

@ECHO Done!

=========================================================================================

语句

SET dbhost=127.0.0.1
SET dbuser=root
SET dbpasswd=xxxx
SET dbName=dbnamexx
SET sqlpath=./
set sqlfile=statistics_fee_data_sync.sql

mysql -h%dbhost% -u%dbuser% -p%dbpasswd% %dbName% -e "select * from cityinfo2;select * from correct2 limit 100;"