'mysql.column_stats' doesn't exist and Table 'mysql.index_stats' doesn't exist
在生產庫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`);
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`);
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28939273/viewspace-1990410/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL 啟動報錯 Table 'mysql.plugin' doesn't existMySqlPlugin
- about Res folder doesn't exist in android projectAndroidProject
- Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist解決辦法ErrorMySql
- ERROR 1146 (42S02): Table 'mysql.slow_log' doesn't existErrorMySql
- lower_case_table_names引數設定解決Error Code: 1146. Table doesn't exist?Error
- Linux環境下MySQL報Table 'xxx' doesn't exist錯誤解決方法LinuxMySql
- [BUG反饋]子查詢報錯,Base table or view not found: 1146 Table 'onethink.(' doesn't existView
- doesn't contain a valid partition tableAI
- MySQL 5.5原始碼安裝時啟動資料庫報錯"Table 'mysql.user' doesn't exist??"MySql原始碼資料庫
- MySQL查詢報錯:ERROR 1146 (42S02): Table 'craw.sitePageConfig' doesn't existMySqlError
- 帝國CMS重新整理資料表article提示Table ‘empirecms.phome_ecms_’ doesn’t exist的解決
- Android Studio Git No tracked branch configured for branch branch_name or the branch doesn't existAndroidGit
- scrollTop doesn't scroll on Chrome 61Chrome
- C++ doesn't name a typeC++
- 解決安裝ubuntu系統時出現錯誤:(10, “debian-installer/locale doesn‘t exist“)Ubuntu
- Solaris 5.8 CRON doesn't work with regular user
- 易優CMS【錯誤程式碼】 SQLSTATE【42S02】:Base table or view not found:1146 Table‘111.ey_admin_theme‘doesn‘t exist-eyoucmsSQLView
- if doesn't support the "condition"attribute 問題解決
- MIRO Error:Table T169V: entry G180 does not existError
- Field ‘spu_id‘ doesn‘t have a default valu 解決辦法
- ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default valueError
- SNMP TABLE ERROR : Requested table is empty or does not existError
- OSError: [E050] Can‘t find model ‘en_core_web_sm‘. It doesn‘t seem to be a shortcut link, a Python pErrorWebPython
- 解決pgpool啟動報錯 ifup[/sbin/ip] doesn't have setuid bitUI
- 2018 icpc徐州站網路賽 H Ryuji doesn't want to study
- 資料庫報錯java.sql.SQLException: Field ‘id‘ doesn‘t have a default value資料庫JavaSQLException
- 安裝mysql遇到ERROR: 1136 Column count doesn't match value count at row 1MySqlError
- ORA-00942: table or view does not existView
- adb server version (31) doesn’t match this client (36); killing… 的解決方法Serverclient
- pymysql.err.OperationalError: (1136, “Column count doesn‘t match value count at row 1“)報錯反省。MySqlError
- ORA-01720: grant option does not exist for 'HWCUST.H_OKC_REGION_TERRITORY_T'
- wget下載安裝時出現錯誤doesn‘t match requested host name錯誤wget
- MySQL5.6新增root使用者報錯:Field 'ssl_cipher' doesn't have a default valueMySql
- in與exist , not in與not exist 的區別
- SAP MM 對採購訂單執行收貨,報錯 - Table T169P entry ZNMI does not exist -
- MYSQL ERROR 1146 Table doesnt exist 解析MySqlError
- Provisioning profile doesn't include signing certificate問題解決,以及各種證書
- Oracle in and existOracle