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!

TRWTFCoder
  • 11
  • 1

2 Answers2

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
tink
  • 1,035
  • 11
  • 20
  • 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 Nov 08 '12 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 Nov 08 '12 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.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
Dennis Kaarsemaker
  • 19,277
  • 2
  • 44
  • 70