I had this problem and found this solution, it work for me. Copy the content of backups(C:\xampp\mysql\backup\) folder into data(C:\xampp\mysql\data) folder.
The “CREATE TABLE if not exists” statement is very useful in creating a table because it will not create the table if the table of the same name already exists in the database.
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.
This error can also occur when setting lower_case_table_names
to 1
, and then trying to access tables that were created with the default value for that variable. In that case you can revert it to the previous value and you will be able to read the table.
cp -a /var/lib/mysql /var/lib/mysql-backup
/var/lib/mysql
mysqldump >dbase.mysql
/var/lib/mysql
/var/lib/mysql-backup
to /var/lib/mysql
mysqldump < dbase.mysql
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With