How to log sql errors when restoring database from dump file

12,186

@Rob in your prompt (cmd?) try something like:

mysql -u your_user your_database <c:\path\to\your_script.sql >stdout_output.txt 2>stderr_output.txt

there isn't angle brackets, the symbols '<' and '>' are redirect signals of command line shell.

Share:
12,186
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin almost 2 years

    Pre-apologies for any duplication here but I swear I have researched (and learned a lot in the process).

    Environment is MySQL 5.5 using MYISAM table engine on Windows 7.

    The job is to restore a database dumped from MySQL 4.0. I do this from the command line (I tried using Oracle's MySQL Workbench import utility but it would fail if it encountered an error). The restoration completes but I know there are errors getting thrown. I want to capture those so I can make sure the restoration completes without error.

    General_log doesn't seem to capture anything (and yes - it's turned on). The other log file (local_host_name.log) doesn't seem to capture sql statement level errors at all.

    Is there a method for capturing errors when restoring from the command line? Is there a way to perhaps edit the dump file itself with throw/catch statements that would write errors to a log file?

    Thanks in advance -- I'm a MS SQL guy who is brand new to MySQL.