【MySQL】5.6.x InnoDB Error Table mysql.innodb_table_stats not found
【問題描述】:
檢查error log的時候發現大量warnings:
[Warning] InnoDB Error Table mysql.innodb_index_stats not found
[Warning] InnoDB Error Table mysql.innodb_table_stats not found
[Warning] InnoDB Error Table mysql.slave_master_info not found
[Warning] InnoDB Error Table mysql.slave_relay_log_info not found
[Warning] InnoDB Error Table mysql.slave_worker_info not found
或在開啟innodb表時,在err-log裡會列印出:
InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
Error: Fetch of persistent statistics requested for table "{databse_name}"."{table_name}" but the required system tables mysql.innodb_table_stats and mysql.innodb_index_stats are not present or have unexpected structure. Using transient stats instead.
【解決方案】:
先看看能否drop table,如果說表不存在,則繼續下一步。
刪除datadir下mysql資料庫中的這五張表的frm檔案(如有ibd也一併刪除)
再執行如下語句,重新建立這五張表:
最後重啟mysqld即可。
可能形成這種問題的原因是做了形如rm -rf ibdata ib_logfile0 等操作。
作者微信公眾號(持續更新)
檢查error log的時候發現大量warnings:
[Warning] InnoDB Error Table mysql.innodb_index_stats not found
[Warning] InnoDB Error Table mysql.innodb_table_stats not found
[Warning] InnoDB Error Table mysql.slave_master_info not found
[Warning] InnoDB Error Table mysql.slave_relay_log_info not found
[Warning] InnoDB Error Table mysql.slave_worker_info not found
或在開啟innodb表時,在err-log裡會列印出:
InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
Error: Fetch of persistent statistics requested for table "{databse_name}"."{table_name}" but the required system tables mysql.innodb_table_stats and mysql.innodb_index_stats are not present or have unexpected structure. Using transient stats instead.
【解決方案】:
先看看能否drop table,如果說表不存在,則繼續下一步。
-
DROP TABLE mysql.innodb_index_stats;
-
DROP TABLE mysql.innodb_table_stats;
-
DROP TABLE mysql.slave_master_info;
-
DROP TABLE mysql.slave_relay_log_info;
- DROP TABLE mysql.slave_worker_info;
刪除datadir下mysql資料庫中的這五張表的frm檔案(如有ibd也一併刪除)
- rm -rf $datadir/mysql/innodb_index_stats.*
- rm -rf $datadir/mysql/innodb_table_stats.*
- rm -rf $datadir/mysql/slave_master_info.*
- rm -rf $datadir/mysql/slave_relay_log_info.*
- rm -rf $datadir/mysql/slave_worker_info.*
再執行如下語句,重新建立這五張表:
- USE mysql;
-
-
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;
-
-
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 `slave_master_info` (
-
`Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file.',
-
`Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log currently being read from the master.',
-
`Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last read event.',
-
`Host` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'The host name of the master.',
-
`User_name` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The user name used to connect to the master.',
-
`User_password` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The password used to connect to the master.',
-
`Port` int(10) unsigned NOT NULL COMMENT 'The network port used to connect to the master.',
-
`Connect_retry` int(10) unsigned NOT NULL COMMENT 'The period (in seconds) that the slave will wait before trying to reconnect to the master.',
-
`Enabled_ssl` tinyint(1) NOT NULL COMMENT 'Indicates whether the server supports SSL connections.',
-
`Ssl_ca` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Authority (CA) certificate.',
-
`Ssl_capath` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path to the Certificate Authority (CA) certificates.',
-
`Ssl_cert` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL certificate file.',
-
`Ssl_cipher` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the cipher in use for the SSL connection.',
-
`Ssl_key` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL key file.',
-
`Ssl_verify_server_cert` tinyint(1) NOT NULL COMMENT 'Whether to verify the server certificate.',
-
`Heartbeat` float NOT NULL,
-
`Bind` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Displays which interface is employed when connecting to the MySQL server',
-
`Ignored_server_ids` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The number of server IDs to be ignored, followed by the actual server IDs',
-
`Uuid` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The master server uuid.',
-
`Retry_count` bigint(20) unsigned NOT NULL COMMENT 'Number of reconnect attempts, to the master, before giving up.',
-
`Ssl_crl` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Revocation List (CRL)',
-
`Ssl_crlpath` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path used for Certificate Revocation List (CRL) files',
-
`Enabled_auto_position` tinyint(1) NOT NULL COMMENT 'Indicates whether GTIDs will be used to retrieve events from the master.',
-
PRIMARY KEY (`Host`,`Port`)
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Master Information';
-
-
CREATE TABLE `slave_relay_log_info` (
-
`Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file or rows in the table. Used to version table definitions.',
-
`Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the current relay log file.',
-
`Relay_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The relay log position of the last executed event.',
-
`Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log file from which the events in the relay log file were read.',
-
`Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last executed event.',
-
`Sql_delay` int(11) NOT NULL COMMENT 'The number of seconds that the slave must lag behind the master.',
-
`Number_of_workers` int(10) unsigned NOT NULL,
-
`Id` int(10) unsigned NOT NULL COMMENT 'Internal Id that uniquely identifies this record.',
-
PRIMARY KEY (`Id`)
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Relay Log Information';
-
-
CREATE TABLE `slave_worker_info` (
-
`Id` int(10) unsigned NOT NULL,
-
`Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
-
`Relay_log_pos` bigint(20) unsigned NOT NULL,
-
`Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
-
`Master_log_pos` bigint(20) unsigned NOT NULL,
-
`Checkpoint_relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
-
`Checkpoint_relay_log_pos` bigint(20) unsigned NOT NULL,
-
`Checkpoint_master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
-
`Checkpoint_master_log_pos` bigint(20) unsigned NOT NULL,
-
`Checkpoint_seqno` int(10) unsigned NOT NULL,
-
`Checkpoint_group_size` int(10) unsigned NOT NULL,
-
`Checkpoint_group_bitmap` blob NOT NULL,
-
PRIMARY KEY (`Id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Worker Information';
最後重啟mysqld即可。
可能形成這種問題的原因是做了形如rm -rf ibdata ib_logfile0 等操作。
作者微信公眾號(持續更新)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29773961/viewspace-2100952/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL innodb buffer pool 命中率以及快取了哪些 InnoDB TableMySql快取
- MySQL InnoDB File-Per-Table表空間MySql
- MySQL中innodb_file_per_table引數MySql
- mysql之 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11MySqlError
- [ERROR] Can't open the mysql.plugin tableErrorMySqlPlugin
- MysqL錯誤之_ERROR! MySQL server PID file could not be found!MySqlErrorServer
- MYSQL ERROR 1146 Table doesnt exist 解析MySqlError
- MySQL報錯Table 'plugin' is read only [ERROR] Can't open the mysql.plugin table.MySqlPluginError
- mysql-python安裝時Environment Error: mysql_config not foundMySqlPythonError
- Error 15: File not found for RedhatErrorRedhat
- MySQL 引數- Innodb_File_Per_Table(獨立表空間)MySql
- MySQL innodb_table_stats表不存在的解決方法MySql
- mysql 啟動錯誤(InnoDB: Operating system error number 13 )MySqlError
- MySQL 5.6複製報錯Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND;MySqlError
- mysql5.6在匯入時報innodb_table_stats不存在MySql
- SNMP TABLE ERROR : Requested table is empty or does not existError
- 為Zabbix MySQL設定獨立表空間innodb_file_per_tableMySql
- MySQL DROP TABLE刪除表報錯'ERROR 1051 (42S02): Unknown table'MySqlError
- [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11Error
- Error ./bin/my_print_defaults: not foundError
- [ 丹臣]利用innodb_table_monitor來trace innodb內部資訊
- MySQL 8.0 Reference Manual(讀書筆記78節-- InnoDB Table and Page Compression (1))MySql筆記
- MySQL 8.0 Reference Manual(讀書筆記79節-- InnoDB Table and Page Compression (2))MySql筆記
- MySQL InnoDB 索引MySql索引
- mysql [ERROR] InnoDB: ./ibdata1 can't be opened in read-write modeMySqlError
- NoSuchObjectException(message:ods_db.event table not found)ObjectException
- ERROR in Entry module not found Error Can't resolve 'babel' in ' UseErrorBabel
- MySQL ERROR 1031 (HY000) at line 33: Table storage engine forMySqlError
- HPUX Error 23 File table overflowUXError
- ERROR: No abbreviations files found in ...nonbreaking_prefixesError
- 【MySQL】mysql optimize tableMySql
- 關於java.lang.Error: Probable fatal error:No fonts found問題JavaError
- mysql innodb索引高度MySql索引
- MySQL InnoDB update流程MySql
- MySQL Deadlocks in InnoDBMySql
- MySQL [ERROR] Slave I/O: Found a Gtid_log_event or Previous_gtids_log_eventMySqlError
- MySQL 5.5 報錯"ERROR 1075 (42000): Incorrect table definition"MySqlError
- 【MySQL】ERROR 1005 (HY000): Can't create table' (errno: 150)MySqlError