MySQL Error Reference

This page lists the common MySQL errors that you may encounter, organized by category for easier navigation.

Complete error list can be found in the MySQL official documentation.

Connection Errors

These errors occur when there are issues establishing or maintaining connections to the MySQL server.

  • ERROR 1040 (HY000): Too Many Connections

    ERROR 1040 (HY000): Too many connections
  • ERROR 1130 (HY000): Host is not allowed to connect

    ERROR 1130 (HY000): Host 'client-hostname' is not allowed to connect to this MySQL server
  • ERROR 2002 (HY000): Can't connect to local MySQL server through socket

    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
  • ERROR 2003 (HY000): Can't connect to MySQL server on '[host]'

    ERROR 2003 (HY000): Can't connect to MySQL server on 'hostname' (110)
  • ERROR 2013 (HY000): Lost connection to MySQL server during query

    ERROR 2013 (HY000): Lost connection to MySQL server during query

Authentication & Authorization Errors

These errors relate to user authentication, permissions, and access control issues.

  • ERROR 1041 (42000): You are not allowed to create a user with GRANT

    ERROR 1041 (42000): You are not allowed to create a user with GRANT
  • ERROR 1044 (42000): Access denied for user to database

    ERROR 1044 (42000): Access denied for user 'username'@'hostname' to database 'db_name'
  • ERROR 1045 (42000): Access denied for user 'username'@'hostname' (using password: YES)

    ERROR 1045 (42000): Access denied for user 'username'@'hostname' (using password: YES)
  • ERROR 1049 (42000): Unknown Database

    ERROR 1049 (42000): Unknown database 'db_name'
  • ERROR 1142 (42000): Command denied to user

    ERROR 1142 (42000): SELECT command denied to user 'username'@'hostname' for table 'table_name'
  • ERROR 1396 (HY000): Operation failed for user

    ERROR 1396 (HY000): Operation CREATE USER failed for 'username'@'hostname'

Query Syntax & Logic Errors

These errors occur due to incorrect SQL syntax, logic issues, or incompatible query structures.

  • ERROR 1055 (42000): SELECT list is not in GROUP BY clause and contains nonaggregated column

    ERROR 1055 (42000): Expression #2 of SELECT list is not in GROUP BY clause and contains
    nonaggregated column 'database_name.table_name.column_name' which is not functionally
    dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
  • ERROR 1111 (HY000): Invalid use of group function

    ERROR 1111 (HY000): Invalid use of group function
  • ERROR 1175 (HY000): You are using safe update mode

    ERROR 1175 (HY000): You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column

Data Integrity Errors

These errors relate to data consistency, constraints, transactions, and referential integrity violations.

  • ERROR 1062 (23000): Duplicate entry

    ERROR 1062 (23000): Duplicate entry '123' for key 'PRIMARY'
  • ERROR 1213 (40001): Deadlock found when trying to get lock

    ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction
  • ERROR 1215 (HY000): Cannot add foreign key constraint

    ERROR 1215 (HY000): Cannot add foreign key constraint
  • ERROR 1216 (23000): Cannot add or update a child row: a foreign key constraint fails

    ERROR 1216 (23000): Cannot add or update a child row: a foreign key constraint fails
  • ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails

    ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails
  • ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails

    ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails

Resource & Configuration Errors

These errors are related to server configuration limits, resource constraints, and system settings.

  • ERROR 1153 (08S01): Got a packet bigger than 'max_allowed_packet'

    ERROR 1153 (08S01): Got a packet bigger than 'max_allowed_packet' bytes

Edit this page on GitHub