How to log SQL batch queries in a file

1.8k views Asked by At

Let's say I run a query in MySQL

mysql> delete from subscriber where mobile in (9899347241); Query OK, 2 rows affected, 18 warnings (32.91 sec)

So now I have a abc.sql which contains no. of such delete, update sql's and I run it using

mysql -h host -u user -p < abc.sql > output.txt

I have tried different options like --verbose, --tee. None seems to log the info text Query OK, 2 rows affected, 18 warnings (32.91 sec)

How can i log this. Basically when I have run the batch file, I want to be able to see if each query ran ok. One way for me to do this is to include a select query before and after the delete/update but there must be a better way to see if queries ran successfully.

2

There are 2 answers

0
Emmanuel VOET On BEST ANSWER

-vvv is the solution to what we are looking for.

0
RS3 On

2>&1 is what you are looking for