0

Is it possible to capture the messages that can be listed with SHOW ERRORS and store them in a log table? Like, is there a table somewhere, that I can select from?

0

Use

SELECT * 
FROM sys.statements_with_errors_or_warnings 
WHERE last_seen > NOW() - INTERVAL ??? MINUTE;

Set a reasonable time limit.

Or query to performance_schema, tables events_statements_current, events_statements_history and events_statements_history_long.

11
  • Unfortunately these don't seem to exist in 5.5
    – j4nd3r53n
    Feb 27 '20 at 12:57
  • @j4nd3r53n Yes, I have seen my 8.0.17... look for similar system tables in your version.
    – Akina
    Feb 27 '20 at 12:59
  • @j4nd3r53n Check out here - it would appear that sys.statements_with_errors_or_warnings only appeared in 5.6. To the OP, why are you still using 5.5 - it went end-of-support in Dec 2018? Feb 27 '20 at 15:35
  • @Vérace thanks - as for why I still use 5.5: I'm still new in this job, so I haven't quite got to the point where I can update. There are developers that need to change code (timestamp format has changed), different departments to coordinate etc. The aim is to get to the latest version, but it isn't as simple as all that.
    – j4nd3r53n
    Feb 28 '20 at 9:48
  • It never is! :-) Seriously though, I cannot recommend it strongly enough - I mean on 5.5, you don't have Window/Analytic functions, CTEs (the WITH clause), CHECK constraints... the list goes on. Your productivity should shoot up on upgrade. Having said that, it's worthwhile testing - we do get questions here from time to time of the sort "I've upgraded and now my system is slow...", but in this case, the pros far outweigh the cons and you can always ask here if you have a problem! Feb 28 '20 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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