' Mysql.column_stats ' doesn ' t exist and Table ' mysql.index_stats ' doesn ' t exist

Source: Internet
Author: User

Modify the field type in the production library MARIABDB to indicate the following error:
? Table ' mysql.column_stats ' doesn ' t exist
Table ' mysql.index_stats ' doesn ' t exist

? The MARIADB version is as follows:?
? MariaDB [mysql]> SELECT @ @version;
+---------------------+
| @ @version |
+---------------------+
| 10.0.12-mariadb-log |
+---------------------+

To connect to the MySQL database check table:
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 |
+---------------------------+

Check for a few tables found missing hint errors,column_stats, Index_stats, Table_stats

Workaround:
Create the table above in the main library:
CREATE TABLE IF not EXISTS ' column_stats ' (
' db_name ' varchar (+) not NULL COMMENT ' Database the table was in. ',
' table_name ' varchar (+) not NULL COMMENT ' table name. ',
' column_name ' varchar (+) 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 is 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 (+) not NULL COMMENT ' Database the table was in. ',
' table_name ' varchar (+) not NULL COMMENT ' table name ',
' index_name ' varchar (+) not NULL COMMENT ' name of the index ',
' prefix_arity ' int (ten) unsigned not NULL COMMENT ' Index prefix length. 1 for the first Keypart, 2 for the first. InnoDB ' s extended keys is supported. ',
' Avg_frequency ' decimal (12,4) DEFAULT NULL COMMENT ' Average number of records one would find for given values of (Keypart1, Keypart2, ...), provided the values would be found in the table. '
) Engine=innodb DEFAULT Charset=utf8;

CREATE TABLE IF not EXISTS ' table_stats ' (
' db_name ' varchar (+) not NULL COMMENT ' Database the table was in. ',
' table_name ' varchar (+) not NULL COMMENT ' table name. ',
' Cardinality ' bigint (+) 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.