views:

38

answers:

3

I have a number of really large files with many insert statements (18.7 million in the largest one). At the mysql> prompt if I do a source file.sql or a ./file.sql everything works good, things get inserted, but there is output for every run statement which ways: Query OK, 1 row affected (0.00 sec).

When run this way these inserts can take a very long time. Is there a way to run sql queries quietly, with no output?

+3  A: 

You can direct them straight into the mysql client:

mysql -u... -p my_database < file.sql
Greg
Thanks. The main reason I was concerned about this was that I thought the output was slowing it down. After running your solution it didn't seem to speed it up. Any suggestions?
chadgh
Two thoughts: 1) copy the file to the database machine and run it locally. 2) Use fewer statements, inserting multiple items at once.
Keith Randall
Just copying the files to the database machine made all the difference in the world. Thanks Keith.
chadgh
A: 

If you're doing it in a Unix shell, you could just send the output to /dev/null, using the -o option.

Matt Ball
+1  A: 

I run on the command line:

>mysql -p <Database> < file.sql

I dont get output that way.

CSharpAtl