How do I view MySQL query errors and warnings in RDS? I am still using MySQL 5.6.
I have looked in the log files (under Log & Events), but they remain empty even when I do a query that generates an error in the console. For example, I ran a query that gave me error 1054 (unknown column), but nothing appeared in the error log. I've realized that this isn't the type of errors that get logged.
The log_warnings parameter is set to 1. I've tried setting general_log=1, but that generates way to much info, and still doesn't log the errors.
The reason that I need this is that I am upgrading from 5.6 to 5.7. I need like to see what warnings I'm currently getting since some warning will become errors in 5.7, and need to be fixed.
CodePudding user response:
You can run SHOW WARNINGS immediately after the query, to get all conditions (errors, warnings, and notes). You have to do this in the client that ran the query. It's not a log.
There is no log for error, warnings, or notes for each query. The errors and warnings in the MySQL Server error log are for server errors, not for individual queries.
Queries that can't be parsed are not written to the general log or the slow query log by default. If you set the global option log_raw=1
then the general log will log erroneous queries, but still won't log the error itself. Even with that option, the slow query log won't log queries that can't be parsed.
A free tool from Percona may be helpful for your testing. pt-upgrade allows you to use a query log file as input, and it runs the query against two instances of MySQL, and reports any difference in errors or warnings, or results.
I thought of another partial solution: the PERFORMANCE_SCHEMA has tables for statement events. The statement event tables have columns for error number and message caused by each query, if any. But only a count of the warnings, not the warning message(s) themselves.