1

Let me first start off by saying I am not an experienced linux user.

I am trying to debug a mysql script in linux, however, my issue is that most of the queries are successful so I can not see the error messages because they scroll off the screen. I am executing the queries from a large file using the \. command.

I was wondering if there was a way to show ONLY the error messages when I exececute the sql file. Right now it is showing both error messages and Query OK,....

I don't really care about the queries that are ok, just the errors.

Thanks!

2 Answers 2

0

You didn't mention much about HOW you use it; but if the "scrolling off the screen" is the problem at hand: capture ALL output in a file.

<command> | tee output 2>&1
2
  • when I did: bash> mysql | tee output 2>&1 Nothing happened when I did mysql> \\. myfile.sql | tee output 2>&1 I got an error
    – TRWTFCoder
    Commented Nov 8, 2012 at 18:49
  • something like this: mysql --batch -e 'SHOW TABLES'; | tee output 2>&1. Also please mention WHAT error you're getting; with the info provided it's hard to diagnose.
    – tink
    Commented Nov 8, 2012 at 18:52
0

You might want to run mysql in batch mode (mysql -B), that makes it not give any output besides errors, not even a prompt.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .