• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:

  • You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
  • You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
  • If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

Previously on "MySQL - how to suppress informational messages"

Collapse

  • Sysman
    replied
    Originally posted by NickFitz View Post
    I would expect it's sending errors to stderr rather than stdout. If so, you can redirect stdout to /dev/null and stderr to a file; it would vary depending on the shell, but I think the bash way of doing that would be something like:

    Code:
    $verbosescript 1> /dev/null 2> errors.txt
    EDIT: I just checked in bash, and the above does work for my test - I didn't test with MySQL but I assume it sends error messages to stderr, so that should work.
    And the real answer is that I was trying to use the SOURCE command from the mysql> prompt. If I use the following instead, all those informationals disappear and errors such as "Table already exists" and "Duplicate entry 'xx' for key 'PRIMARY'" are displayed:

    Code:
    $mysql -u username < test.sql
    It does conk out straight away if it encounters a syntax error.

    Edit: I did this on Windows BTW
    Last edited by Sysman; 18 October 2010, 11:14.

    Leave a comment:


  • NickFitz
    replied
    Originally posted by Sysman View Post
    Thanks Nick. Tons faster, even though it leaves me not knowing whether there were any errors in there. Off to count the INSERTs in the source now

    I was hoping for something option to only spit out the errors. ISTR reading about a build option to omit the MySQL stats for every operation but I can't find it right now...
    I would expect it's sending errors to stderr rather than stdout. If so, you can redirect stdout to /dev/null and stderr to a file; it would vary depending on the shell, but I think the bash way of doing that would be something like:

    Code:
    $verbosescript 1> /dev/null 2> errors.txt
    EDIT: I just checked in bash, and the above does work for my test - I didn't test with MySQL but I assume it sends error messages to stderr, so that should work.
    Last edited by NickFitz; 15 October 2010, 16:15.

    Leave a comment:


  • Sysman
    replied
    Thanks Nick. Tons faster, even though it leaves me not knowing whether there were any errors in there. Off to count the INSERTs in the source now

    I was hoping for something option to only spit out the errors. ISTR reading about a build option to omit the MySQL stats for every operation but I can't find it right now...

    Leave a comment:


  • NickFitz
    replied
    Originally posted by Sysman View Post
    I have a large file containing SQL statements to create a few MySQL tables and it is spitting out a gazillion messages like this:

    Code:
    Query OK, 1 row affected (0.00 sec)
    How do I suppress this lot?

    I could redirect them to a file, but it's still a lot of processing, and there's 750 MB of input file. Surely there's a simple and low overhead way.
    OS X | Linux | Other Unix variants:

    Code:
    $verbosescript > /dev/null
    Windows | MS-DOS | CP/M:

    Code:
    C:\>verbosescript > NUL

    Leave a comment:


  • Sysman
    started a topic MySQL - how to suppress informational messages

    MySQL - how to suppress informational messages

    I have a large file containing SQL statements to create a few MySQL tables and it is spitting out a gazillion messages like this:

    Code:
    Query OK, 1 row affected (0.00 sec)
    How do I suppress this lot?

    I could redirect them to a file, but it's still a lot of processing, and there's 750 MB of input file. Surely there's a simple and low overhead way.
Working...
X