Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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!

share|improve this question

2 Answers 2

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
share|improve this answer
    
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 8 '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 8 '12 at 18:52

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.