You are here: All articles » Programming » Execute multiple queries in one mysql command line
-
Execute multiple queries in one mysql command line
written: 8 years ago
category: Programming
Previous
Next
On the command line, you may want to execute more than one SQL command at once. Most hints recommend a batch file to accomplish that, but that requires an additional file placed somewhere where you may forget it.
You can also fire several queries with the --execute parameter, separated by semicolon:
mysql -hlocalhost -uroot --execute"TRUNCATE dba.log_customer; TRUNCATE dba.log_quote; TRUNCATE dba.log_summary;"
...and the slightly shorter version:
mysql -hlocalhost -uroot -e"TRUNCATE dba.log_customer; TRUNCATE dba.log_quote; TRUNCATE dba.log_summary;"
Comments:
-
Andrew King
5 years ago
Permalink
-
Ansgar
5 years ago
Permalink
Leave a comment
-