在生产库MariabDB中修改字段类型,提示如下错误:
​Table 'mysql.column_stats' doesn't exist
Table 'mysql.index_stats' doesn't exist

​MariaDB版本如下:​
​MariaDB [mysql]> select @@version;
+---------------------+
| @@version |
+---------------------+
| 10.0.12-MariaDB-log |
+---------------------+

连接mysql数据库检查表:
MariaDB [mysql]> show tables;
+---------------------------+
| Tables_in_mysql |
+---------------------------+
| columns_priv |
| db |
| event |
| func |
| general_log |
| gtid_slave_pos |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| host |
| innodb_index_stats |
| innodb_table_stats |
| inventory |
| ndb_binlog_index |
| plugin |
| proc |
| procs_priv |
| proxies_priv |
| servers |
| slave_master_info |
| slave_relay_log_info |
| slave_worker_info |
| slow_log |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+---------------------------+

检查发现缺少提示错误的几张表,column_stats、index_stats、table_stats

解决方法:
在主库创建以上表:
CREATE TABLE IF NOT EXISTS `column_stats` (
`db_name` varchar(64) NOT NULL COMMENT 'Database the table is in.',
`table_name` varchar(64) NOT NULL COMMENT 'Table name.',
`column_name` varchar(64) NOT NULL COMMENT 'Name of the column.',
`min_value` varchar(255) DEFAULT NULL COMMENT 'Minimum value in the table (in text form).',
`max_value` varchar(255) NOT NULL COMMENT 'Maximum value in the table (in text form).',
`nulls_ratio` decimal(12,4) DEFAULT NULL COMMENT 'Fraction of NULL values (0 - no NULLs, 0.5 - half values are NULLs, 1 - all values are NULLs).',
`avg_length` decimal(12,4) DEFAULT NULL COMMENT 'Average length of column value, in bytes. Counted as if one ran SELECT AVG(LENGTH(col)). This doesn''t count NULL bytes, assumes endspace removal for CHAR(n), etc.',
`avg_frequency` decimal(12,4) DEFAULT NULL COMMENT 'Average number of records with the same value',
`hist_size` tinyint(3) unsigned DEFAULT NULL COMMENT 'Histogram size in bytes, from 0-255.',
`hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB') DEFAULT NULL COMMENT 'Histogram type. See the histogram_type system variable.',
`histogram` varbinary(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `index_stats` (
`db_name` varchar(64) NOT NULL COMMENT 'Database the table is in.',
`table_name` varchar(64) NOT NULL COMMENT 'Table name',
`index_name` varchar(64) NOT NULL COMMENT 'Name of the index',
`prefix_arity` int(10) unsigned NOT NULL COMMENT 'Index prefix length. 1 for the first keypart, 2 for the first two, and so on. InnoDB''s extended keys are supported.',
`avg_frequency` decimal(12,4) DEFAULT NULL COMMENT 'Average number of records one will find for given values of (keypart1, keypart2, ..), provided the values will be found in the table.'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `table_stats` (
`db_name` varchar(64) NOT NULL COMMENT 'Database the table is in .',
`table_name` varchar(64) NOT NULL COMMENT 'Table name.',
`cardinality` bigint(21) DEFAULT NULL COMMENT 'Number of records in the table.'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

ALTER TABLE `column_stats`
ADD PRIMARY KEY (`db_name`,`table_name`,`column_name`);

ALTER TABLE `index_stats`
ADD PRIMARY KEY (`db_name`,`table_name`,`index_name`,`prefix_arity`);

ALTER TABLE `table_stats`
ADD PRIMARY KEY (`db_name`,`table_name`);

'mysql.column_stats' doesn't exist and Table 'mysql.index_stats' doesn't exist的更多相关文章

  1. Mysql 升级重装后连接出错 Table \'performance_schema.session_variables\' doesn\'t exist

    升级重装后  连接出错 报这个错误 Table 'performance_schema.session_variables' doesn't exist   使用这个命令即可 [root@localh ...

  2. MySQL 5.6 解决InnoDB: Error: Table "mysql"."innodb_table_stats" not found.问题

    在安装MySQL 5.6.30时,安装完成后,后台日志报如下警告信息:2016-05-27 12:25:27 7fabf86f7700 InnoDB: Error: Table "mysql ...

  3. 解决mysql插入数据报错[Err] 1146 - Table 'performance_schema.session_status' doesn't exist

    解决办法:1.打开cmd 执行命令cd/ 进入C盘根目录2.dir 查看C盘根目录下文件夹  找到 Program Files文件夹3.cd Program Files 进入该文件夹下 再输入dir ...

  4. MySQL中报错: [Err] 1146 - Table 'performance_schema.session_status' doesn't exist 解决办法

    解决办法:1.打开cmd 执行命令cd/ 进入C盘根目录2.dir 查看C盘根目录下文件夹  找到 Program Files文件夹3.cd Program Files 进入该文件夹下 再输入dir ...

  5. 慢日志之二:ERROR 1146 (42S02): Table 'mysql.slow_log' doesn't exist,分析诊断工具之四

    去查看最新的slow log,发现没有最新的记录,上去检查slow log是否开启了. MySQL> show variables like '%slow%'; +--------------- ...

  6. ERROR 1146 (42S02): Table 'mysql.servers' doesn't exist

    MySQL版本:mysql5.7.21 修改用户权限,刷新权限表,报1146 mysql> flush privileges; ERROR 1146 (42S02): Table 'mysql. ...

  7. Mysql官方文档中争对安全添加列的处理方法。Mysql Add a Column to a table if not exists

    Add a Column to a table if not exists MySQL allows you to create a table if it does not exist, but d ...

  8. MySQL: Table 'mysql.plugin' doesn't exist的解决

    安装解压版MySQL以后,不能启动,日志里面出现了这个错误: MySQL: Table 'mysql.plugin' doesn't exist 这是因为mysql服务启动时候找不到内置数据库&quo ...

  9. mysql [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist (转载)

    mysql报错Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist 2013-11-2 ...

随机推荐

  1. Android开发-API指南-Manifest介绍

    App Manifest 英文原文:http://developer.android.com/guide/topics/manifest/manifest-intro.html 采集(更新)日期:20 ...

  2. webpack基础+webpack配置文件常用配置项介绍+webpack-dev-server

    一.webpack基础 1.在项目中生成package.json:在项目根目录中输入npm init,根据提示输入相应信息.(也可以不生成package.json文件,但是package.json是很 ...

  3. 怎样用VB编写.DLL动态链接库文件

    VB一般可以生成两种特殊的DLL,一个是ActiveX DLL和ActiveX Control(*.ocx).这两种DLL都是VB支持的标准类型,在VB自身的例子中有,你可以参考.更详细的介绍可以参考 ...

  4. Modifiers

    Sometimes it is useful for a function to modify the objects it gets as parameters. In that case, the ...

  5. ndk-gdb 对java/native code联合调试(升级版)

    之前写过一篇 关于android native 开发,调试的文章(http://www.cnblogs.com/yaozhongxiao/archive/2012/03/13/2393959.html ...

  6. 关于cookie

    CookieHelper.WriteCookie("DEPID", "theway", depid);   //先写入cookie //再读取cookie Us ...

  7. telnet localhost 8089 ==》》命令使用

    GET /ccc/abc.html HTTP/1.1 host:localhost     客户端连上web服务器后,若想获得web服务器中的某个web资源,需遵守一定的通讯格式, HTTP协议用于定 ...

  8. MVC ckeditor的基本使用

    之前在自己的WebForm练习项目里面用到过ckeditor,时隔蛮久后,今天再一次把ckeditor运用到MVC里面,用于最近着手开发的企业站的新闻动态的内容之新增与修改. 找到的资料都说要把下载的 ...

  9. flask页面操作gpn接口

    https://wizardforcel.gitbooks.io/flask-extension-docs/content http://cabeza.cn/blog/2016/02/28/datat ...

  10. CAPI3 HTTP文件服务器搭建(共享目录版)

    IIS中运行的程序和WebDAV访问的虚拟目录是共享目录的情况下,非常容易报错,设置如下: 一.程序访问共享目录: 1.配置本地用户IIS权限 2.添加应用池 3.配置连接标示 4.站点关联此应用池即 ...