Bienvenido! - Willkommen! - Welcome!

Bitácora Técnica de Tux&Cía., Santa Cruz de la Sierra, BO
Bitácora Central: Tux&Cía.
Bitácora de Información Avanzada: Tux&Cía.-Información
May the source be with you!

Friday, December 3, 2010

Server Error Codes and Messages

MySQL programs have access to several types of error information when the server returns an error. For example, the mysql client program displays errors using the following format:
shell> SELECT * FROM no_such_table;
ERROR 1146 (42S02): Table 'test.no_such_table' doesn't exist
The message displayed contains three types of information:
  • A numeric error code (1146). This number is MySQL-specific and is not portable to other database systems.
  • A five-character SQLSTATE value ('42S02'). The values are specified by ANSI SQL and ODBC and are more standardized. Not all MySQL error numbers are mapped to SQLSTATE error codes. The value 'HY000' (general error) is used for unmapped errors.
  • A message string that provides a textual description of the error.
Server error information comes from the following source files. For details about the way that error information is defined, see the MySQL Internals manual, available at
  • The Error values and the symbols in parentheses correspond to definitions in the include/mysqld_error.h MySQL source file.
  • The SQLSTATE values correspond to definitions in the include/sql_state.h MySQL source file.
    SQLSTATE error codes are displayed only if you use MySQL version 4.1 and up. SQLSTATE codes were added for compatibility with X/Open, ANSI, and ODBC behavior.
  • The Message values correspond to the error messages that are listed in the sql/share/errmsg.txt file. %d and %s represent numbers and strings, respectively, that are substituted into the messages when they are displayed.
Because updates are frequent, it is possible that those files will contain additional error information not listed here:

No comments: