Skip to content
FR
  1. LuzineDebug
  2. Databases (SQL)

Databases (SQL) errors: causes and fixes

MySQL, MariaDB and PostgreSQL errors: access denied, duplicate keys, deadlocks, password authentication. The queries and settings that fix them.

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Fix "ERROR 1045 (28000): Access denied for user 'root'@'localhost'" (MySQL, MariaDB)

The MySQL or MariaDB server was reached, but it rejects the user + host + password combination. Check the password and that the ac…

Beginner 10 min
ERROR 1062 (23000): Duplicate entry '[email protected]' for key 'users.users_email_unique'

Fix "ERROR 1062 (23000): Duplicate entry for key" (MySQL, MariaDB, PostgreSQL)

You are inserting or updating a row with a value that already exists in a PRIMARY KEY or UNIQUE column. Find the existing row, the…

Beginner 10 min
ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction

Fix "Deadlock found when trying to get lock; try restarting transaction" (MySQL, PostgreSQL)

Two transactions are waiting on each other’s locks; the engine rolls one back to unblock the other. Retry the rolled-back transact…

Advanced 30 min
FATAL: password authentication failed for user "postgres"

Fix FATAL: password authentication failed for user "postgres" (PostgreSQL)

PostgreSQL received the connection but the password does not match the role, or the role has no password. Log in locally with sudo…

Intermediate 15 min
ERROR 1040 (HY000): Too many connections

Fix "ERROR 1040: Too many connections" (MySQL) and "too many clients already" (PostgreSQL)

The server reached its maximum number of simultaneous connections (max_connections) and refuses new ones. Count who holds the conn…

Intermediate 20 min
ERROR 2006 (HY000): MySQL server has gone away

Fix "ERROR 2006 (HY000): MySQL server has gone away"

The connection existed, but the server closed it before or during the query: inactivity beyond wait_timeout, a packet bigger than…

Intermediate 15 min
ERROR 1054 (42S22): Unknown column 'email' in 'field list'

Fix "ERROR 1054 (42S22): Unknown column in 'field list'" (MySQL)

The query uses a column that does not exist in the target table: migration not run on this database, a typo, a wrong alias, or a v…

Beginner 10 min
ERROR: relation "users" does not exist

Fix "ERROR: relation "users" does not exist" (PostgreSQL)

PostgreSQL cannot find the table: it was not created in this database (migrations not run), you are connected to another database,…

Intermediate 10 min

Other areas