AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / dba / 问题 / 54608
Accepted
giorgio79
giorgio79
Asked: 2013-12-07 12:31:05 +0800 CST2013-12-07 12:31:05 +0800 CST 2013-12-07 12:31:05 +0800 CST

InnoDB:错误:升级到 mysql 5.6 后找不到表“mysql”。“innodb_table_stats”

  • 772

我从 5.5 升级到 mysql 5.6,现在我的日志在启动时到处都是这样的消息

我在这里找到了一个可能的解决方案,但它似乎并不正式。 http://forums.mysql.com/read.php?22,578559,579891#msg-579891

2013-12-06 21:08:00 7f87b1d26700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2013-12-06 21:08:00 7f87b1d26700 InnoDB: Recalculation of persistent statistics requested for table "drupal"."sessions" but the required persistent statistics storage is not present or is corrupted. Using transient stats instead.
2013-12-06 21:08:07 7f903c09c700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.

任何官方解决方案或 100% 修复?

mysql innodb
  • 2 2 个回答
  • 107997 Views

2 个回答

  • Voted
  1. Best Answer
    RolandoMySQLDBA
    2013-12-07T18:24:36+08:002013-12-07T18:24:36+08:00

    我之前在:Cannot open table mysql/innodb_index_stats中解决了这个问题

    这些表是在您安装 MySQL 5.6 时为您创建的。但是,从 MySQL 5.5 升级不会调用这些表的创建。以下是手动创建它们的脚本:

    innodb_index_stats

    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;
    

    innodb_table_stats

    USE mysql;
    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;
    

    slave_master_info

    USE mysql;
    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';
    

    slave_relay_log_info

    USE mysql;
    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';
    

    slave_worker_info

    USE mysql;
    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';
    

    选择

    另一种解决方法是从 MySQL 5.6 实例创建脚本。

    步骤 01:转到运行 MySQL 5.6 的数据库服务器,或在测试机器上安装 MySQL 5.6。

    步骤02:mysqldump这5个表到一个文本文件

    INNODB_TABLES="innodb_index_stats"
    INNODB_TABLES="${INNODB_TABLES} innodb_table_stats"
    INNODB_TABLES="${INNODB_TABLES} slave_master_info"
    INNODB_TABLES="${INNODB_TABLES} slave_relay_log_info"
    INNODB_TABLES="${INNODB_TABLES} slave_worker_info"
    mysqldump -uroot mysql ${INNODB_TABLES} > InnoDB_MySQL_Tables.sql
    

    然后,您可以InnoDB_MySQL_Tables.sql在升级之前在任何运行 MySQL 5.5 的数据库服务器上运行。

    • 74
  2. Asoka Diggs
    2014-11-21T16:54:12+08:002014-11-21T16:54:12+08:00

    罗兰多的回答对我有用,还有一些补充。我遇到了同样的问题,这 5 个表通过 SHOW TABLES 显示,但是 SELECT 或对表的其他操作导致找不到表。

    为了解决这个问题,使用 Rolando 的回答,我需要:

    • DROP TABLE <tablename> -- 全部 5 个表

    • 在文件系统中,删除剩余的 .ibd 文件(.frm 文件被 删除DROP TABLE)

    • 然后我停止并启动了 mysqld 实例(不知道是否需要 - 让我很高兴)

    • 罗兰多提供的CREATE TABLE陈述随后毫无问题地运行。

    • 10

相关问题

  • 是否有任何 MySQL 基准测试工具?[关闭]

  • 我在哪里可以找到mysql慢日志?

  • 如何优化大型数据库的 mysqldump?

  • 什么时候是使用 MariaDB 而不是 MySQL 的合适时机,为什么?

  • 组如何跟踪数据库架构更改?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何让sqlplus的输出出现在一行中?

    • 3 个回答
  • Marko Smith

    选择具有最大日期或最晚日期的日期

    • 3 个回答
  • Marko Smith

    如何列出 PostgreSQL 中的所有模式?

    • 4 个回答
  • Marko Smith

    授予用户对所有表的访问权限

    • 5 个回答
  • Marko Smith

    列出指定表的所有列

    • 5 个回答
  • Marko Smith

    如何在不修改我自己的 tnsnames.ora 的情况下使用 sqlplus 连接到位于另一台主机上的 Oracle 数据库

    • 4 个回答
  • Marko Smith

    你如何mysqldump特定的表?

    • 4 个回答
  • Marko Smith

    使用 psql 列出数据库权限

    • 10 个回答
  • Marko Smith

    如何从 PostgreSQL 中的选择查询中将值插入表中?

    • 4 个回答
  • Marko Smith

    如何使用 psql 列出所有数据库和表?

    • 7 个回答
  • Martin Hope
    Stéphane 如何列出 PostgreSQL 中的所有模式? 2013-04-16 11:19:16 +0800 CST
  • Martin Hope
    Mike Walsh 为什么事务日志不断增长或空间不足? 2012-12-05 18:11:22 +0800 CST
  • Martin Hope
    Stephane Rolland 列出指定表的所有列 2012-08-14 04:44:44 +0800 CST
  • Martin Hope
    haxney MySQL 能否合理地对数十亿行执行查询? 2012-07-03 11:36:13 +0800 CST
  • Martin Hope
    qazwsx 如何监控大型 .sql 文件的导入进度? 2012-05-03 08:54:41 +0800 CST
  • Martin Hope
    markdorison 你如何mysqldump特定的表? 2011-12-17 12:39:37 +0800 CST
  • Martin Hope
    pedrosanta 使用 psql 列出数据库权限 2011-08-04 11:01:21 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 对 SQL 查询进行计时? 2011-06-04 02:22:54 +0800 CST
  • Martin Hope
    Jonas 如何从 PostgreSQL 中的选择查询中将值插入表中? 2011-05-28 00:33:05 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 列出所有数据库和表? 2011-02-18 00:45:49 +0800 CST

热门标签

sql-server mysql postgresql sql-server-2014 sql-server-2016 oracle sql-server-2008 database-design query-performance sql-server-2017

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve