Common MYSQL Error – Table doesn’t exist


If you get either of the following errors, it usually means that no table exists in the default database with the given name:

Table ‘TableName’ doesn’t exist
Can’t find file: ‘TableName’ (errno: 2)
In some cases, it may be that the table does exist but that you are referring to it incorrectly:

Because MySQL uses directories and files to store databases and tables, database and table names are case sensitive if they are located on a file system that has case-sensitive file names.

Even for file systems that are not case sensitive, such as on Windows, all references to a given table within a query must use the same lettercase.

You can check which tables are in the default database with SHOW TABLES.

What are MYSQL Errors?

MySQL programs have access to several types of error information when the server returns an error.

The MYSQL message displayed contains three types of information:
A numeric error code. This number is MySQL-specific and is not portable to other database systems.
A five-character SQLSTATE value. The values are specified by ANSI SQL and ODBC and are more standardized. Not all MySQL error numbers are mapped to SQLSTATE error codes.
A message string that provides a textual description of the error.
When an error occurs, you can access the MySQL error code, the SQLSTATE value, and the message string using C API functions:
MySQL error code: Call mysql_errno()
SQLSTATE value: Call mysql_sqlstate()
Error message: Call mysql_error()

Hope this was helpful.

SQLServerF1 Team
Information about MYSQL Error Codes and Error Messages or Warnings on Windows, Linux Operating Systems.


Leave a Reply

Your email address will not be published. Required fields are marked *