0

I run bat-file in Windows to clean MySQL Data Base at night. bat-file just use sql-script with simple delete-where operators.

code in bat-file like : "date /T >> cleaner_front.log" log some useful info to output file

code in script.sql file like : SELECT '14. delete from table (7 days)' AS '_'; SELECT NOW(); log some useful info too.

But if script.sql contains some errors (like table doesn't exists), error-message (ERROR 1146 (42S02) at line 56: Table '...' doesn't exist) was not written to output file

How can I write error messages from MySQL to common cleaner_front.log file during execution?

1 Answer 1

2

here is the launch string with error logging:

"path\to\mysql.exe" --host=host --user=user --password=pass -N -f < cleaner.sql 1> cleaner.log 2> cleaner_err.log

Sign up to request clarification or add additional context in comments.

1 Comment

Well looks like the poster didn't appreciate your help - but I do. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.