InnoDB: Error: Table "mysql"."innodb_table_stats" not found.

Not sure if this is the right place asking mysql questions.

Got this error with a fresh Mysql 5.7.23 installation.

Tried the solution on this page: https://dba.stackexchange.com/questions/48166/cannot-open-table-mysql-innodb-index-stats/48189

It nearly fixed it, but unfortunately all pages I can find is dealing with mysql 5.6x, the table structure in mysql 5.7x is different.

If I do mysql_upgrade after I create these tables, I got the error "Table 'mysql.plugin' doesn't exist".

Maybe the best solution is finding a mysql 5.7x server and dump these tables. Anyone can help me with that? Thanks!
 
You don't need to create the initial databases. Just make sure /var/db/mysql/ is completely empty and owned by mysql:mysql. Then start the service; service mysql-server start. The scripts automatically detect the empty directory and will do the correct initialization automatically.
 
Wow, that's incredible, can't believe such a simple and elegant solution, thank you so much! I spent several hours trying everything...

Before I clean up the mysql directly, I did a mysqldump, the dump should succeed by the file size despite an error message.

When I restore the backup, I got the following error, no data was restored.

Code:
ERROR 1840 (HY000) at line 24: @@GLOBAL.GTID_PURGED can only be set when @@GLOBAL.GTID_EXECUTED is empty.

I restored the data from an earlier backup before the migration, only small difference, so, all is working well now. But I'm wondering why the last backup/restore failed, only one mysql installation, no slave server. Any ideas on that?
 
The error seems to be because of a difference in the GTID setting. You either had that on when you made the backup and it's now off on the server or the other way around.
 
The dump was made on MySQL 5.6 and you're now importing it into 5.7 right? Do you remember the exact version of the 5.6? GTIDs were introduced in 5.6.6, if the dump was made before that version that might explain it.
 
No, it's all done on the same MySQL 5.7.23, I dumped the db to clean up the mysql directory.

I don't know anything about GTIDs, never touched it.
 
Back
Top