Smiles in a Jar
Smiles in a Jar

Reputation: 489

How to log SQL batch queries in a file

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.

Upvotes: 4

Views: 1847

Answers (2)

Emmanuel VOET
Emmanuel VOET

Reputation: 86

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

Upvotes: 7

RS3
RS3

Reputation: 194

2>&1 is what you are looking for

Upvotes: -1

Related Questions