Table ‘mysql.innodb_table_stats’ doesn’t exist in engine. mysql.innodb_table_stats not found
Table ‘mysql.innodb_table_stats’ doesn’t exist in engine. mysql.innodb_table_stats not found
My server mysql error log is getting filled with the above error. Error shows that the table ‘innodb_table_stats’ is missing. Do the below steps to fix the error.
You must have server root access to fix the error message.
1. Log into your linux Server via SSH as root
2. First you must take a backup of the mySQL db using the below command
mysqldump mysql > mysql.sql
3. Change to directory /var/lib/mysql/mysql using cd command
cd /var/lib/mysql/mysql
rename the file innodb_table_stats.ibd innodb_table_stats.ibd.bakk
mv innodb_table_stats.ibd innodb_table_stats.ibd.bakk
4. Drop the table innodb_table_stats
mysql>
mysql>use mysql;
mysql>drop table innodb_table_stats;
5. Now create the table “innodb_table_stats” using the below commands
mysql>
mysql> use mysql;
mysql>CREATE TABLE `innodb_table_stats` (
`database_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL,
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`n_rows` bigint(20) unsigned NOT NULL,
`clustered_index_size` bigint(20) unsigned NOT NULL,
`sum_of_other_index_sizes` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`database_name`,`table_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0;
You have created the table “innodb_table_stats” and won’t see the same error in mySQL server logs.