MySQL error numbers returned by Raft DB
A table of the MySQL error numbers the SQL front-end returns most often, with the SQLSTATE, the usual text, the cause in Raft DB and what to do.
The SQL front-end answers with MySQL's error numbers, SQLSTATE codes and message texts, because drivers and tools read them (the numbers are listed here by how often the code raises them and how often users meet them). Errors and their texts are compared with a real MySQL 9.7 and MariaDB 11.4; the wording of a few differs between the dialects.
Connection and login#
| No. | SQLSTATE | Text | Cause here | Fix |
|---|
| 1040 | 08004 | Too many connections | max_connections reached | Raise it; close idle connections. |
| 1043 | 08S01 | Bad handshake | The first packet from the client was not a valid login | Not a MySQL client, or a proxy that changed the packet. |
| 1045 | 28000 | Login refused for user 'u'@'host' (password supplied: YES|NO) | Unknown user, wrong password, or an account whose host does not match | Connection problems. |
| 1047 | 08S01 | Unknown command | The client sent a command code the front-end does not know | Report with the client and version. |
| 2013 | HY000 | Lost connection to Raft DB: ... | Two-process mode: the link to raftdb-server broke | Check raftdb-server. |
Databases and tables#
| No. | SQLSTATE | Text | Cause here | Fix |
|---|
| 1046 | 3D000 | No database selected | A statement needs a database and none was chosen | USE db. |
| 1049 | 42000 | Unknown database 'x' | The database does not exist or is not this front-end's | SHOW DATABASES. |
| 1007 | HY000 | Can't create database 'x'; database exists | | CREATE DATABASE IF NOT EXISTS. |
| 1050 | 42S01 | Table 'x' already exists | Also a view or a hidden name | IF NOT EXISTS, or drop it. |
| 1051 | 42S02 | Unknown table 'x' | DROP TABLE of a missing table (or of a view) | IF EXISTS. |
| 1146 | 42S02 | The table 'db.t' was not found | Missing, mistyped, or wrong database. Also "The table's storage is missing" when the definition exists but Raft DB has no table | SQL problems. |
| 1103 | 42000 | Incorrect table name 'x' | A name the front-end keeps for itself, or one MySQL refuses | Rename. |
| 1347 | HY000 | 'db.v' is not BASE TABLE | A table statement on a view | Use the right statement. |
| 1288 | HY000 | The table v targeted by the UPDATE cannot be modified | A write to a grouped or otherwise non-updatable view | Write to the table. |
| 1471 | HY000 | The INSERT cannot target v, which does not accept inserted rows | Same | Write to the table. |
| 1356 | HY000 | View references invalid table(s) or column(s) ... | The view's source changed | Re-create the view. |
| 1462 | HY000 | db.v contains view recursion | Views nested over 16 levels | Simplify. |
Columns, keys and definitions#
| No. | SQLSTATE | Text | Cause here | Fix |
|---|
| 1054 | 42S22 | Unknown column 'c' in 'where clause' (or the clause named) | A column that does not exist; also a hidden function-index column | Check spelling and aliases. |
| 1052 | 23000 | The column name 'c' in field list could refer to more than one table | The name exists in two joined tables | Qualify it. |
| 1060 | 42S21 | Duplicate column name 'c' | CREATE/ALTER TABLE | |
| 1061 | 42000 | Duplicate key name 'k' | | |
| 1068 | 42000 | More than one primary key was defined | | |
| 1072 | 42000 | Column 'c' named in the key is not in the table | | |
| 1075 | 42000 | The table definition is wrong: a single auto column is allowed, and it has to be a key | | |
| 1067 | 42000 | The default value given for 'c' is not valid | | |
| 1091 | 42000 | DROP of 'x' failed; the column or key may not exist | | |
| 1176 | 42000 | No key called 'k' can be found in table 't' | An index hint or DROP INDEX names a missing key | |
| 1426 | 42000 | Precision given for 'c' is too big; the largest allowed is 65 | DECIMAL(p,...) with p above 65 | |
| 3105 | HY000 | The value specified for generated column 'c' in table 't' is not allowed | A value given for a generated column | Use DEFAULT. |
| 3819 | HY000 | Check constraint is violated | A CHECK failed | |
| 4028 | HY000 | A table must have at least one visible column | All columns invisible | |
| 3753, 3757 | 42000, HY000 | Cannot create a functional index on ... JSON/GEOMETRY / BLOB or TEXT | | Use CAST. |
| 3008 | HY000 | Foreign key cascade delete/update exceeds max depth of 15 | A cascade chain too deep | |
| 1822 | HY000 | Failed to add the foreign key constraint. Missing index for constraint ... | The referenced table has no index on the key | Add the index. |
Data#
| No. | SQLSTATE | Text | Cause here | Fix |
|---|
| 1048 | 23000 | A NULL value cannot be stored in column 'c' | NULL into a NOT NULL column (also in a multi-row insert: the whole statement fails) | |
| 1062 | 23000 | The value 'v' is already present for key 'k' | Primary key or unique index. MySQL words the key 'table.k', MariaDB 'k'. Text compares without case | |
| 1136 | 21S01 | The number of values at row N does not equal the number of columns | | |
| 1264 | 22003 | The value for column 'c' (row N) is outside the allowed range | Strict mode | Widen the column or fix the value. |
| 1265 | 01000 | The value stored in column 'c' (row N) was cut off | | |
| 1292 | 22007 | Incorrect date/time/number value for column 'c' at row N | | |
| 1364 | HY000 | No default value is defined for field 'c' | A NOT NULL column with no default left out | |
| 1366 | HY000 | The integer value 'v' given for column 'c' (row N) is not valid (and the same for other types) | A value of the wrong type; also a statement that is not valid UTF-8 | |
| 1406 | 22001 | The value for column 'c' (row N) is too long | | |
| 1451 | 23000 | Deleting or updating the parent row would violate a foreign key constraint | A child row exists | Delete children, or declare ON DELETE CASCADE. |
| 1452 | 23000 | Adding or updating the child row would violate a foreign key constraint | No parent row | |
| 3140 | 22032 | Invalid JSON text: "..." at position N in value for column 't.c' | A document that is not JSON | |
| 3141 | 22032 | The JSON text given as argument N of function f is invalid | | |
Statements, functions and expressions#
| No. | SQLSTATE | Text | Cause here | Fix |
|---|
| 1235 | 42000 | This version of the Raft DB MySQL front-end doesn't yet support 'X' | Valid MySQL that Raft DB has not built | What is not there yet. |
| 1064 | 42000 | Syntax error in the SQL statement; ... Error near '...' at line N | A syntax error (the text gives the place); also in CHECK and functional key parts | |
| 1065 | 42000 | Query was empty | | |
| 1105 | HY000 | Raft DB: ... (or another unknown error text) | A refusal by Raft DB that has no MySQL equivalent, passed on with its message; also "could not claim a unique value" and "the definition of table 't' is damaged"; a statement on a bootstrap administrator (see below) | Read the text after Raft DB:. |
| 1111 | HY000 | A group function is used where it is not allowed | An aggregate where it is not allowed | |
| 1210 | HY000 | Incorrect arguments to f | | |
| 1222 | 21000 | The SELECT statements being combined return different numbers of columns | UNION branches differ | |
| 1305 | 42000 | FUNCTION f is unknown | An unknown function (many MySQL functions exist; some do not) | Check the function list. |
| 1317 | 70100 | The query was interrupted | A stored routine that ran more than 50 million statements and loop turns was stopped | |
| 1193 | HY000 | Unknown system variable 'x' | SET of a variable that does not exist | System variables. |
| 1243 | HY000 | Prepared statement handler (N) is unknown to mysqld_stmt_execute | | |
| 1461 | 42000 | Can't create more than max_prepared_stmt_count statements | 16,382 per session | |
Routines, triggers, sequences#
| No. | Text | Cause |
|---|
| 1318 | Incorrect number of arguments for PROCEDURE db.p | CALL with the wrong count |
| 1324 | Undefined CURSOR: c | |
| 1329 | No data: no row was fetched, chosen or handled | A FETCH past the end with no handler |
| 1308 | LEAVE with no matching label | |
| 1359, 1360 | Trigger already exists / does not exist | |
| 1442 | Can't update table 't' in stored function/trigger because it is already used by statement which invoked this stored function/trigger | A trigger changing its own table |
| 1456 | Routine r went past its recursion limit of 0, which comes from the max_sp_recursion_depth variable | |
| 4084 | Sequence 'db.s' is exhausted | NEXTVAL past MAXVALUE without CYCLE (MariaDB dialect) |
| 4085 | Sequence 'db.s' has option values outside the permitted range | |
| 4091 | Unknown SEQUENCE: 's' | |
Privileges and accounts#
| No. | SQLSTATE | Text | Cause here |
|---|
| 1044 | 42000 | User 'u'@'h' is not allowed to use database 'd' | No privilege on the database |
| 1142 | 42000 | cmd is not permitted for user 'u' on table 't' | |
| 1143 | 42000 | cmd is not permitted for user 'u' on column 'c' of table 't' | |
| 1227 | 42000 | Access denied; you need (at least one of) the SUPER ... privilege(s) | SET GLOBAL without SUPER |
| 1396 | HY000 | Operation CREATE USER failed for 'u'@'h' | The account exists (or does not, for DROP/ALTER) |
| 1105 | HY000 | the password of an account named in the connector's configuration is set there | SET PASSWORD or ALTER USER on a bootstrap administrator |
| 1105 | HY000 | an account named in the connector's configuration already has every privilege | GRANT to a bootstrap administrator |
Other numbers in the privilege family (1141, 1147, 1133, 1410, 1221, 1144, 1827) are explained in Privileges.
Errors from raftdb-server, not MySQL numbers#
| Where | Code | Meaning |
|---|
| Binary protocol | 11 FORBIDDEN | Role or database scope refuses the request |
| Binary protocol | 12 READ_ONLY | A replica or a managed node that is not the primary |
| Binary protocol | 13 TOO_BIG | A UDP reply that does not fit a datagram |
| HTTP | 401 unauthenticated, 403 forbidden, 403 read_only_replica, 409 not_leader, 409 conflict, 400 confirm_required | See HTTP administration API |
When a refusal from raftdb-server reaches a MySQL client through the HTTP link it is translated: 404 becomes 1049, 409 conflict 1007, 403 1044, a broken link 2013, anything else 1105 with Raft DB: message.
See also#