patternsqlModerate
Disable console output when executing a SQL file using MySQL source command
Viewed 0 times
executingfilesqlsourcedisableoutputmysqlusingwhencommand
Problem
I begin by launching the MySQL command line tool:
The last
Then I choose a database:
Then I execute SQL form a file like this:
That's when things go slowly. I've executed part of the file before so the console is filled with duplicate row errors which slow execution badly. I get 5-10 statements executed per second. Without duplicate rows the code executes tens of thousands of statements (30k+) every 5 seconds.
I need to do this since the file is large and I can't execute it in one go.
mysql --user=myusername --password=mypassword --silent --force -bThe last
-b option is used to disable beep on error.Then I choose a database:
use Mydatabasename;Then I execute SQL form a file like this:
source c:\x\y\z\myfile.sqlThat's when things go slowly. I've executed part of the file before so the console is filled with duplicate row errors which slow execution badly. I get 5-10 statements executed per second. Without duplicate rows the code executes tens of thousands of statements (30k+) every 5 seconds.
I need to do this since the file is large and I can't execute it in one go.
Solution
Here is the problem. The OS has two modes to print things
The
Try one of the following, and see if it works:
Give it a Try !!!
CAVEAT : I have dealt with something this before when answering a question about mysqldump : How to log verbose output from mysqldump?
- stdout
- stderr
The
--silent only affects stdout. How do you nail stderr?Try one of the following, and see if it works:
mysql --user=myusername --password=mypassword --silent --force -b 2> nul
mysql --user=myusername --password=mypassword --silent --force -b --tee=nulGive it a Try !!!
CAVEAT : I have dealt with something this before when answering a question about mysqldump : How to log verbose output from mysqldump?
Code Snippets
mysql --user=myusername --password=mypassword --silent --force -b 2> nul
mysql --user=myusername --password=mypassword --silent --force -b --tee=nulContext
StackExchange Database Administrators Q#27208, answer score: 11
Revisions (0)
No revisions yet.