开发者

Batch files and MySQL: pass a block of commands instead of another .bat file

开发者 https://www.devze.com 2023-03-16 11:58 出处:网络
I see that I can pass a batch file to mysql in order to run a sequence of commands.But can I put those commands in the same batch file as the one that ini开发者_C百科tiates the mysql app?

I see that I can pass a batch file to mysql in order to run a sequence of commands. But can I put those commands in the same batch file as the one that ini开发者_C百科tiates the mysql app?

I.e. can I pass a block of batch commands to mysql instead of passing a batch file, so that it might look something like this:

mysql < [list of commands, not a .bat filename]


You can also pipe commands into MySQL if you don't want/have them in a file:

echo " ...some SQL... " | mysql 


The term "Batch file" in the mySQL manual doesn't refer to DOS .BAT files, but to a file with many mySQL commands.

 mysql < list.sql

will do exactly what you need.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号