B.1 Error Message Sources and Elements

This section discusses how error messages originate within MySQL and the elements they contain.

Error Message Sources

Error messages can originate on the server side or the client side:

Example server-side error messages written to the error log:

Example server-side error message sent to client programs, as displayed by the *note 'mysql': mysql. client:

 mysql> SELECT * FROM no_such_table;
 ERROR 1146 (42S02): Table 'test.no_such_table' doesn't exist

Example client-side error message originating from within the client library, as displayed by the *note 'mysql': mysql. client:

 $> mysql -h no-such-host
 ERROR 2005 (HY000): Unknown MySQL server host 'no-such-host' (0)

Whether an error originates from within the client library or is received from the server, a MySQL client program may respond in varying ways. As just illustrated, the client may display the error message so the user can take corrective measures. The client may instead internally attempt to resolve or retry a failed operation, or take other action.

Error Message Elements

When an error occurs, error information includes several elements: an error code, SQLSTATE value, and message string. These elements have the following characteristics:

 File: manual.info.tmp, Node: error-interfaces, Next: problems, Prev: error-message-elements, Up: error-handling