MySQL Create Table Error – Table Doesn’t Exist

MySQL

I am new to MySQL, and I am having a problem where if I try to create a Table in my newly created Database "recommend", I get the following error:

ERROR 1146 (42S02): Table 'recommend.Users' doesn't exist

I checked related posts here and on the internet but nothing helped.
If I use the MySQL command line I still get the same error.

SELECT DATABASE() FROM DUAL;

+------------+

| DATABASE() |

+------------+

| recommend  |

+------------+

1 row in set (0.00 sec)

but then when i run this command :

mysql> use recommend
Database changed

mysql> CREATE TABLE Users (UserName VARCHAR(20),password VARCHAR(20),PRIMARY KEY(UserName));

ERROR 1146 (42S02): Table 'recommend.Users' doesn't exist

I also tried using Navicat and still get the same error 🙁

Best Answer

I had the same problem. I actually read this thread before I got lucky with a simple solution. I attempted to drop my table and it worked, in your case your table is User:

DROP TABLE Users;

The table does not exist, so naturally MySQL complains:

Error Code: 1051. Unknown table 'Users'

But then I ran my CREATE TABLE statement again and it worked. Hopefully others can validate this works every time? A lot easier than going to an error log, especially if you are not the greatest DBA/System Admin/Hacker.