Name

SHOW ERRORS

Synopsis

SHOW [COUNT(*)] ERRORS [LIMIT [offset,] count]

Use this statement to display error messages for previous SQL statements for the current session. To get a total number of error messages, use the COUNT(*) clause. This cannot be used with the LIMIT clause, though. The LIMIT clause is used to limit the number of errors displayed. An offset can be given along with the count to specify a starting point for displaying error messages.

This statement is available as of Version 4.1 of MySQL. It will not display warnings or notes—just error messages. Use the SHOW WARNINGS statement to get all three.

Here are a couple of examples of how you can use this statement:

SHOW ERRORS;
SHOW COUNT(*) ERRORS;

The first line displays all error messages in an ASCII-formatted table. The second line returns the number of error messages.

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.