MySQL innodb_table_stats table does not exist
MySQL version 5.6.14
The company's error logs for several MySQL servers show that several system tables do not exist.
Innodb_table_stats
Innodb_index_stats
Slave_master_info
Slave_relay_log_info
Slave_worker_info
This is because the dba may have deleted the ibdata1 file during database initialization.
After the restart, the database will automatically create an ibdata1 file, but the above system table is also an innodb engine, so it cannot be accessed.
This does not affect services, but error logs are written when innobackupex is used for backup.
This information is found in the last error log, which affects daily checks.
Solution.
1. Delete the above system 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;
2. delete the related. frm. ibd file.
Rm-rf innodb_index_stats *
Rm-rf innodb_table_stats *
Rm-rf slave_master_info *
Rm-rf slave_relay_log_info *
Rm-rf slave_worker_info *
3. Recreate the system table
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 .',
'Artbeat' 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 ';
4. If it is an Slave, stop copying and record pos and other information
Mysql> stop slave;
Query OK, 0 rows affected (0.09 sec)
5. Restart the database
6. If an error is reported when Slave is started, use the information in Step 4 to change the master again.
When deleting the ibdata1 file, remember that there are five innodb tables in the system database...
Refer:
Http://stackoverflow.com/questions/15767652/mysql-error-table-mysql-innodb-table-stats-not-found
This article permanently updates the link address: