This just happened to me and after a while I found the answer on a blog article, and wanted to put it here as well.
If you copy the MySQL data directory from /var/lib/mysql
to /path/to/new/dir
, but only copy the database folders (i.e. mysql
, wpdb
, ecommerce
, etc) AND you do have InnoDB tables, your innodb tables will show up in ‘show tables’ but queries on them (select
and describe
) will fail, with the error Mysql error: table db.tableName doesn't exist
. You’ll see the .frm
file in the db directory, and wonder why.
For InnoDB tables, it’s important to copy over the ib*
files, which in my case were ibdata1
, ib_logfile0
, and ib_logfile1
. Once I did the transfer making sure to copy those over, everything worked as expected.
If your my.cnf
file contains innodb_file_per_table
the .ibd
file will be present in the db directory but you still need the ib*
files.