mysql5.6在匯入時報innodb_table_stats不存在

datapeng發表於2018-08-07

今天在處理問題時遇到這個報錯
InnoDB: Error: Fetch of persistent statistics requested for table "mytest"."pomstd" but the required system tables mysql.innodb_table_stats and mysql.innodb_index_stats are not present or have unexpected structure. Using transient stats insttestd.
InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
InnoDB: Recalculation of persistent statistics requested for table "mytest"."pomstd" but the required persistent statistics storage is not present or is corrupted. Using transient stats insttestd.

檢查目錄,沒有找到這個檔案
這是mysql5.6新增的效能分析檔案,通常處理辦法就是建立此檔案:
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;

CREATE TABLE `innodb_index_stats` (
   `database_name` varchar(64) COLLATE utf8_bin NOT NULL,
   `table_name` varchar(64) COLLATE utf8_bin NOT NULL,
   `index_name` varchar(64) COLLATE utf8_bin NOT NULL,
   `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
   `stat_name` varchar(64) COLLATE utf8_bin NOT NULL,
   `stat_value` bigint(20) unsigned NOT NULL,
   `sample_size` bigint(20) unsigned DEFAULT NULL,
   `stat_description` varchar(1024) COLLATE utf8_bin NOT NULL,
   PRIMARY KEY (`database_name`,`table_name`,`index_name`,`stat_name`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0;

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29371470/viewspace-2199352/,如需轉載,請註明出處,否則將追究法律責任。

相關文章