Back to Home

SQL Errors

Complete guide to SQL database error codes from MySQL, PostgreSQL, and other databases.

16 Error Codes
1062
Duplicate entry

MySQL error occurs when trying to insert a duplicate value in a column with UNIQUE constraint.

1045
Access denied

MySQL authentication failed due to incorrect username or password.

2002
Can't connect to server

MySQL client cannot establish connection to the database server.

1054
Unknown column

The specified column does not exist in the table.

1146
Table doesn't exist

The specified table is not found in the database.

1215
Cannot add foreign key constraint

Foreign key constraint cannot be created due to data type mismatch or missing referenced column.

1452
Cannot add or update child row

Foreign key constraint fails because referenced value doesn't exist in parent table.

1364
Field doesn't have a default value

Trying to insert a row without providing value for a NOT NULL column that has no default.

1264
Out of range value

Value exceeds the maximum allowed for the column data type.

1050
Table already exists

Attempting to create a table that already exists in the database.

23000
Integrity constraint violation

Generic SQL error for constraint violations (unique, foreign key, check constraints).

42S02
Base table or view not found

The table or view specified in the query does not exist.

1064
Syntax error

SQL syntax error in the query statement.

1136
Column count doesn't match

The number of columns in INSERT statement doesn't match the number of values provided.

1142
Command denied

User doesn't have permission to execute the SQL command.

1205
Lock wait timeout exceeded

Query timed out waiting for a table lock, usually due to long-running transactions.