Look up a MySQL error by number or message: what it means, why it happens, read-only checks, safe fixes and examples reproduced on a real MySQL server.
Common errors 10
2002
Can't connect to local MySQL server through socketThe client cannot reach the server through the Unix socket; PHP mysqlnd uses 2002 for any failed connection.
1045
Access denied for user (using password: YES or NO)No account matches this user name, client host and password (or authentication plugin).
1064
You have an error in your SQL syntaxMySQL could not parse the statement; the near text shows where parsing stopped.
1054
Unknown columnA column name cannot be found in any table or alias visible at that point of the query.
1146
Table doesn't existThe database exists but has no table or view with that name.
1046
No database selectedA table was named but the connection has no default database.
1062
Duplicate entry for keyA value already exists in a PRIMARY KEY or UNIQUE index.
1452
Cannot add or update a child row: a foreign key constraint failsA child row points at a parent row that does not exist.
1366
Incorrect integer, decimal or string value for columnA value cannot be converted to the column type or character set, such as text in an INT column or an emoji in a utf8mb3 column.
1205
Lock wait timeout exceeded; try restarting transactionA statement waited longer than innodb_lock_wait_timeout for a row lock held by another transaction.
Connections & Network 6
2002
Can't connect to local MySQL server through socketThe client cannot reach the server through the Unix socket; PHP mysqlnd uses 2002 for any failed connection.
2003
Can't connect to MySQL server on host:portThe TCP connection to the host and port was refused or timed out.
2006
MySQL server has gone awayThe connection was already closed (idle timeout, KILL, restart, oversized packet) when the client used it.
2013
Lost connection to MySQL server during queryThe query was sent but the connection broke before the full answer arrived.
1040
Too many connectionsEvery max_connections slot is in use, usually by idle or leaked connections.
1153
Got a packet bigger than 'max_allowed_packet' bytesA single statement or row exceeded max_allowed_packet; the server closes the connection.
Access & Privileges 3
1045
Access denied for user (using password: YES or NO)No account matches this user name, client host and password (or authentication plugin).
1130
Host is not allowed to connect to this MySQL serverNo account has a host part matching the client host, so the server refuses before authentication.
1142
Command denied to user for tableThe logged-in account lacks the privilege this statement needs on that table.
Syntax & Names 6
1064
You have an error in your SQL syntaxMySQL could not parse the statement; the near text shows where parsing stopped.
1054
Unknown columnA column name cannot be found in any table or alias visible at that point of the query.
1146
Table doesn't existThe database exists but has no table or view with that name.
1046
No database selectedA table was named but the connection has no default database.
1049
Unknown databaseThe database named in the connection, USE or db.table does not exist on this server.
1136
Column count doesn't match value countAn INSERT supplies a different number of values than the columns it fills.
Keys & Constraints 4
1062
Duplicate entry for keyA value already exists in a PRIMARY KEY or UNIQUE index.
1452
Cannot add or update a child row: a foreign key constraint failsA child row points at a parent row that does not exist.
1451
Cannot delete or update a parent row: a foreign key constraint failsA parent row that child rows still reference is being deleted or its key changed.
1048
Column cannot be nullNULL was sent for a column declared NOT NULL.
Data Values & Strict Mode 5
1366
Incorrect integer, decimal or string value for columnA value cannot be converted to the column type or character set, such as text in an INT column or an emoji in a utf8mb3 column.
1406
Data too long for columnA string or binary value is longer than the column allows under strict mode.
1292
Incorrect date or datetime valueA date string is invalid or in the wrong format, or a string could not be converted to a number.
1364
Field doesn't have a default valueAn INSERT left out a NOT NULL column that has no DEFAULT.
1264
Out of range value for columnA number is too large, too small or negative for the column type.
No errors match. Press Search to search full messages, or browse every error.