MySQL > Table doesn't exist. But it does (or it should)
Just in case anyone still cares:
I had the same issue after copying a database directory directly using command
cp -r /path/to/my/database /var/lib/mysql/new_database
If you do this with a database that uses InnoDB
tables, you will get this crazy 'table does not exist' error mentioned above.
The issue is that you need the ib*
files in the root of the MySQL datadir (e.g. ibdata1
, ib_logfile0
and ib_logfile1
).
When I copied those it worked for me.
For me on Mac OS (MySQL DMG Installation) a simple restart of the MySQL server solved the problem. I am guessing the hibernation caused it.
I get this issue when the case for the table name I'm using is off. So table is called 'db' but I used 'DB' in select statement. Make sure the case is the same.