Databases errors
- ERROR 1040 (HY000): Too many connectionsMySQL reached max_connections (default 151). Either the limit is too low for your workload, or the application leaks connections or opens too many (no pooling, too many workers, sleeping connections).
- ERROR 1045 (28000): Access denied for user 'root'@'localhost'MySQL rejected the username/password/host combination. On Ubuntu, root uses socket authentication by default, so log in with sudo mysql and create a separate app user.
- ERROR 1062 (23000): Duplicate entry '1' for key 'PRIMARY'An INSERT or UPDATE would create a second row with the same value in a PRIMARY KEY or UNIQUE index. Decide whether to skip, update the existing row, or fix the data or auto-increment counter.
- ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transactionAn InnoDB transaction waited longer than innodb_lock_wait_timeout (default 50s) for a row lock held by another transaction. Find the blocking transaction, which is often idle and never committed.
- ERROR 1366 (HY000): Incorrect string valueMySQL received bytes that can't be stored in the column's character set — almost always a 4-byte UTF-8 character like an emoji going into a utf8/utf8mb3 column. Switch the column, table and connection to utf8mb4.
- ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint failsYou tried to delete (or change the key of) a row that other rows still reference through a foreign key. MySQL blocks it so the child rows don't end up pointing at nothing.
- ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint failsYou inserted or updated a row whose foreign key value has no matching row in the parent table. Insert the parent first, fix the value, or clean up orphan rows before adding the constraint.
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)The MySQL client tried to connect via a Unix socket file that doesn't exist. Either the MySQL/MariaDB server isn't running, or the client and server disagree on the socket path. Error (2) is ENOENT, (13) is permission denied.
- ERROR: duplicate key value violates unique constraintPostgreSQL rejected an INSERT or UPDATE because a row with the same value already exists in a column with a PRIMARY KEY or UNIQUE constraint. On a _pkey constraint it's usually a sequence that fell behind after manual inserts or a data import.
- ERROR: permission denied for schema publicThe connecting role is not allowed to create objects (or use objects) in the public schema. Since PostgreSQL 15, ordinary users no longer get CREATE on public by default, so migrations fail on fresh databases.
- ERROR: relation does not existPostgreSQL can't find a table, view or sequence with that name in the schemas on your search_path, in the database you're connected to. Usually it's a case-sensitivity issue, the wrong schema or database, or migrations that never ran.
- FATAL: database "myapp" does not existThe PostgreSQL server is running and you authenticated, but there is no database with that name on that server. Often psql is defaulting the database name to your username, or the app points at a different server than you think.
- FATAL: password authentication failed for user "postgres"PostgreSQL rejected the password for that user, or the user has no password set. Set one via sudo -u postgres psql and check pg_hba.conf.
- FATAL: role "username" does not existPostgreSQL has no database user (role) with that name. By default psql connects as your OS username. Connect as the postgres superuser and create the role, or pass the right user with -U.
- FATAL: sorry, too many clients alreadyPostgreSQL reached max_connections. Usually an app is leaking connections or opening too many (one pool per worker/process); the fix is a connection pool, not just a higher limit.
- MISCONF Redis is configured to save RDB snapshots, but it's currently unable to persist to disk.Redis's background save (BGSAVE) failed, so it refuses writes to protect you from losing data. The cause is in the Redis log - usually a full disk, a directory Redis can't write to, or fork failing for lack of memory.
- psql: error: connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refusedNothing is listening on that host and port. PostgreSQL isn't running, listens on another port/address, or is in a container that doesn't publish the port.
- Public Key Retrieval is not allowedMySQL Connector/J refuses to fetch the server's RSA public key to encrypt the password over a non-TLS connection. It happens with the caching_sha2_password (MySQL 8 default) or sha256_password auth plugins when SSL is disabled.
- Specified key was too long; max key length is 767 bytesAn index on a VARCHAR/TEXT column is larger than the storage engine allows. With utf8mb4 each character can take 4 bytes, so `VARCHAR(255)` needs 1020 bytes, over the old 767-byte InnoDB limit.
- sqlite3.OperationalError: database is lockedAnother connection holds a write lock on the SQLite file. Commit or close other connections, enable WAL mode and set a busy timeout.