Command-Line Error Message Interface The range within which a particular error code lies determines whether it originated from within the client library or was received by the client from the server. For information about these ranges, see Error Code Ranges. Regardless of whether an error originates from within the client library or is received from the server, a MySQL client program obtains the error code, SQLSTATE value, message string, and other related information by calling C API functions in the client library: For descriptions of the client library error functions, see MySQL 8.0 C API Developer Guide. A MySQL client program may respond to an error in varying ways. The client may display the error message so the user can take corrective measures, internally attempt to resolve or retry a failed operation, or take other action. For example, (using the  mysql  client), a failure to connect to the server might result in this message: The  perror  program provides information from the command line about error numbers. See Section 4.8.2, “perror — Display MySQL Error Message Information” . For MySQL NDB Cluster errors, use  ndb_perror . See Section 23.4.16, “ndb_perror — Obtain NDB Error Message Information” . This section lists some common problems and error messages that you may encounter. It describes how to determine the causes of the problems and what to do to solve them. When you run into a problem, the first thing you should do is to find out which program or piece of equipment is causing it: •If you have one of the following symptoms, then it is probably a hardware problems (such as memory, motherboard, CPU, or hard disk) or kernel problem: 5285 B.3.1 How to Determine What Is Causing a Problem B.3 Problems and Common Errors Command-Line Error Message Interface • mysql_errno()  returns the MySQL error code. • mysql_sqlstate()  returns the SQLSTATE value. • mysql_error()  returns the message string. • mysql_stmt_errno() ,  mysql_stmt_sqlstate() , and  mysql_stmt_error()  are the corresponding error functions for prepared statements. • mysql_warning_count()  returns the number of errors, warnings, and notes for the most recent statement. shell>  perror 1231 MySQL error code MY-001231 (ER_WRONG_VALUE_FOR_VAR): Variable ’%-.64s’ can’t be set to the value of ’%-.200s’ shell>  ndb_perror 323 NDB error code 323: Invalid nodegroup id, nodegroup already existing: Permanent error: Application error shell>  mysql -h no-such-host ERROR 2005 (HY000): Unknown MySQL server host ’no-such-host’ (0)