【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-python安裝時Environment Error: mysql_config not foundMySqlPythonError
- MySQL報錯Table 'plugin' is read only [ERROR] Can't open the mysql.plugin table.MySqlPluginError
- InnoDB: No valid checkpoint found.
- 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
- 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筆記
- 為Zabbix MySQL設定獨立表空間innodb_file_per_tableMySql
- ERROR: No abbreviations files found in ...nonbreaking_prefixesError
- [PM2][ERROR] Process XXX not foundError
- NoSuchObjectException(message:ods_db.event table not found)ObjectException
- MySQL [ERROR] Slave I/O: Found a Gtid_log_event or Previous_gtids_log_eventMySqlError
- MySQL Deadlocks in InnoDBMySql
- MySQL InnoDB 索引MySql索引
- ERROR 1114 (HY000) The table '' is fullError
- [20221227]a mutating table error without a trigger!.txtError
- mac mysql: command not foundMacMySql
- ERROR: freetype2 not found using pkg-configError
- mysql innodb索引高度MySql索引
- MySQL InnoDB update流程MySql
- Mac -bash: mysql: command not foundMacMySql
- MySQL:Analyze table導致'waiting for table flush'MySqlAI
- MySQL table into a golang strucMySqlGolang
- Mysql innodb引擎(二)鎖MySql
- MySQL InnoDB儲存引擎MySql儲存引擎
- MySQL InnoDB髒頁管理MySql
- MySQL 5.7 InnoDB Tablespace EncryptionMySql
- MySQL InnoDB緩衝池MySql
- [ERROR] InnoDB: ibdata1 different size (rounded down to MB)Error
- centos 7 -bash: mysql: command not foundCentOSMySql
- mysql RSA private key file not foundMySql
- Error executing Jupyter command 'notebok': [Errno 'jupyter-notebok' not found] 2Error
- PHP 5.4 編譯 configure: error: libXpm.(a|so) not found.PHP編譯Error
- [BUG反饋]子查詢報錯,Base table or view not found: 1146 Table 'onethink.(' doesn't existView
- How Logs Work On MySQL With InnoDB TablesMySql
- Mysql innodb引擎(三) 事務MySql