User Tools

Site Tools


table_mysql_._innodb_table_stats_not_found

Problema tras actualizar MySQL InnoDB: Error: Table "mysql"."innodb_table_stats" not found.

A grandes rasgos, la causa es que MySQL 5.5 no incluye todas las tablas que debería (bug) y al actualizar a MySQL 5.6 el error hace acto de presencia. Por suerte tiene fácil y rápida solución.

Bug: http://bugs.mysql.com/bug.php?id=67179

Solución a InnoDB: Error: Table “mysql”.“innodb_table_stats” not found

Borrar estas tablas si existen.

  1. innodb_index_stats
  2. innodb_table_stats
  3. slave_master_info
  4. slave_relay_log_info
  5. slave_worker_info

Comprobar si existen las tablas.

SELECT TABLE_NAME FROM information_schema.tables WHERE table_schema='mysql' AND engine='InnoDB';

Eliminar si existen todos los ficheros .frm y .ibd de las anteriores tablas (/var/lib/mysql/mysql).

Ejecutar el script o bien los comandos de creación de tablas del script five-tables.sql.

Reiniciar mysqld.

Fichero five-tables.sql (http://bugs.mysql.com/file.php?id=19725)

five-tables.sql
/* 
  temporary fix for problem with windows installer for MySQL 5.6.10 on Windows 7 machines.
  I did the procedure on a clean installed MySql, and it worked for me, at least it stopped
  lines of innodb errors in the log and the use of transient innodb tables. So, do it at
  your own risk..
 
  1. drop these tables from mysql:
     innodb_index_stats
     innodb_table_stats
     slave_master_info
     slave_relay_log_info
     slave_worker_info
 
  2. delete all .frm & .ibd of the tables above.
 
  3. run this file to recreate the tables above (source five-tables.sql).
 
  4. restart mysqld.
 
  Cheers, 
  CNL
*/
 
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';
table_mysql_._innodb_table_stats_not_found.txt · Last modified: 2020/12/25 22:57 by 127.0.0.1