When I get an error some of them have an HY code,

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")

What is HY000 in the above context. See this question for another example of HY000 in an error message

1 Answer 1


MySQL reports with ODBC error numbers which include a SQLSTATE. HY000 is a MySQL ODBC extension for there being no ODBC equivalent error number from the docs on Server Error Codes and Messages

A five-character SQLSTATE value ('42S02'). The values are taken from ANSI SQL and ODBC and are more standardized. Not all MySQL error numbers have corresponding SQLSTATE values. In these cases, 'HY000' (general error) is used.

You can find the HY000 Error Codes in error_code.h, and the full list of authoritative ODBC error codes from the Microsoft ODBC Appendix

The 2 "No such file or directory" is operating system specific.

  • Have a look a this book: Pro MySql NDB cluster, it is described as General Error (Vendor specific)
    – McNets
    Commented Jun 3, 2018 at 9:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.