mysql升级报错innodb_table_stats" not found处理

mysql数据库日志报错:

InnoDB: Error: Table "mysql"."innodb_table_stats" not found.

解决办法:

到mysql数据目录下先备份,然后删除以下文件:

innodb_index_stats*
innodb_table_stats*
slave_master_info*
slave_relay_log_info*
slave_worker_info*

然后再mysql控制台执行:

USE mysql
DROP TABLE `innodb_index_stats` ;
DROP TABLE `innodb_table_stats` ;
DROP TABLE `slave_master_info` ;
DROP TABLE `slave_relay_log_info` ;
DROP TABLE `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;
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‘;

参考

http://dba.stackexchange.com/questions/54608/innodb-error-table-mysql-innodb-table-stats-not-found-after-upgrade-to-mys

时间: 2024-09-27 13:35:14

mysql升级报错innodb_table_stats" not found处理的相关文章

mysql编译报错

1.make报错现象 Warning: Bison executable not found in PATH 解决办法 yum -y install bison 2.make报错现象 ake Error at /usr/share/cmake-2.8/Modules/CMakeCXXInformation.cmake:17 (get_filename_component):get_filename_component called with incorrect number of argumen

mysql安装报错

如果编译时出现了以下错误:checking for tgetent in -ltermcap- nochecking for termcap functions library- configure: error: No curses/termcap library found说明 curses/termcap 库没有安装去下载一个ncurses-5.6.tar.gz,wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.6.tar.gztar zx

启动MYSQL 57 报错“The service MYSQL57 failed the most recent........等”的问题解决方式!

每天开机之后,启动MYSQL Notifier就报错,第一次出现重启电脑后解决,后面的几天老是出现,重启电脑好几次都没有解决,感觉很烦人,一定要搞定这个问题找到原因,于是有了下文....... 启动MYSQL 57报错信息"The service MYSQL57 failed the most recent status change request with the message time out has expired and the operation has not been comp

MySql启动报错,无法更新PID文件

MySql启动报错 Starting MySQL.. ERROR! The server quit without updating PID file (/var/lib/mysql..) 1,查看错误日志 2017-08-10 19:38:14 31865 [Note] InnoDB: Initializing buffer pool, size = 50.0M InnoDB: mmap(53657600 bytes) failed; errno 12 2017-08-10 19:38:14

MYSQL 内存报错 Use 'mysqld --thread_stack=#' to specify a bigger stack.

MYSQL 内存报错 Use 'mysqld --thread_stack=#' to specify a bigger stack. 今天在使用mysql的过程中,连接数据库始终无法成功 最后发现是数据库无法执行增加修改的操作 :错误代码 Thread stack overrun:  11552 bytes used of a 131072 byte stack, and 128000 bytes needed.  Use 'mysqld --thread_stack=#' to specif

PHP多次调用Mysql存储过程报错解决办法

PHP多次调用Mysql数据库的存储过程会出现问题,主要问题为存储过程中执行多次SQL语句不能一一释放导致的,网上找了一些解决办法,比如使用 multi_query 然后一个一个释放,但是发现根本不适合我们的项目,我们使用CI框架写的,更多的是使用CI的数据库处理方法.所以只能另辟蹊径. 一次偶然,把Mysql链接方式改成了mysqli,两种不同的PHP连接mysql的扩展,官方在高版本中推荐使用mysqli,结果却奇迹般好了,使用Mysql长连接也行,天意么? PHP多次调用Mysql存储过程

linux mysql启动报错Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

vi /etc/my.cnf  查看日志文件路径: log-error=/var/log/mysqld.log 查看报错日志: 之前的服务器被别人拿了,所以自己买了台美国vps,根据笔记安装完启动mysql,又启动不了. 查看了错误日志 引用 090321 18:55:03 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data /usr/local/mysql/libexec/mysqld: Ta

mysql 启动报错 “mysql-bin.index not found (Errcode: 13)“

安装好mysql数据库后,直接在安装的目录下 /usr/local/mysql  下新建了一个目录data 用于存放数据,建好后,直接去启动数据库,发现启动不了,出现如下报错: mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data /usr/local/mysql/libexec/mysqld: File './mysql-bin.index' not found (Errcode: 13) [E

【Mysql】—— 报错:Can't call commit when autocommit=true

java.sql.SQLException: Can't call commit when autocommit=true at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:934) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:931) at com.mysql.jdbc.ConnectionImpl.commit(ConnectionImpl.jav