1. 程式人生 > >解決方法Table 'performance_schema.session_variables' doesn't exist

解決方法Table 'performance_schema.session_variables' doesn't exist

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show variables like 'performance_schema'; ERROR 1146 (42S02): Table 'performance_schema.session_variables' doesn't exist

執行mysql時,提示Table ‘performance_schema.session_variables’ doesn’t exist

日誌檔案報錯如下:

2017-04-27T08:58:04.195252Z 0 [Warning] System table 'time_zone_leap_second' is expected to be transactional. 2017-04-27T08:58:04.195281Z 0 [Warning] System table 'time_zone_name' is expected to be transactional. 2017-04-27T08:58:04.195289Z 0 [Warning] System table 'time_zone' is expected to be transactional. 2017-04-27T08:58:04.195296Z 0 [Warning] System table 'time_zone_transition_type' is expected to be transactional. 2017-04-27T08:58:04.195303Z 0 [Warning] System table 'time_zone_transition' is expected to be transactional. 2017-04-27T08:58:04.196269Z 0 [Warning] System table 'servers' is expected to be transactional. 2017-04-27T08:58:04.196770Z 0 [ERROR] Incorrect definition of table performance_schema.events_waits_current: expected column 'NESTING_EVENT_TYPE' at position 15 to have type enum('TRANSACTION','STATEMENT','STAGE','WAIT', found type enum('STATEMENT','STAGE','WAIT'). 2017-04-27T08:58:04.196873Z 0 [ERROR] Incorrect definition of table performance_schema.events_waits_history: expected column 'NESTING_EVENT_TYPE' at position 15 to have type enum('TRANSACTION','STATEMENT','STAGE','WAIT', found type enum('STATEMENT','STAGE','WAIT'). 2017-04-27T08:58:04.196968Z 0 [ERROR] Incorrect definition of table performance_schema.events_waits_history_long: expected column 'NESTING_EVENT_TYPE' at position 15 to have type enum('TRANSACTION','STATEMENT','STAGE','WAIT', found type enum('STATEMENT','STAGE','WAIT'). 2017-04-27T08:58:04.197278Z 0 [ERROR] Incorrect definition of table performance_schema.events_waits_summary_by_user_by_event_name: expected column 'USER' at position 0 to have type char(32), found type char(16). 2017-04-27T08:58:04.197369Z 0 [ERROR] Incorrect definition of table performance_schema.events_waits_summary_by_account_by_event_name: expected column 'USER' at position 0 to have type char(32), found type char(16). 2017-04-27T08:58:04.198123Z 0 [ERROR] Column count of performance_schema.setup_actors is wrong. Expected 5, found 3. Created with MySQL 50616, now running 50717. Please use mysql_upgrade to fix this error. 2017-04-27T08:58:04.198356Z 0 [ERROR] Incorrect definition of table performance_schema.setup_objects: expected column 'OBJECT_TYPE' at position 0 to have type enum('EVENT','FUNCTION','PROCEDURE','TABLE','TRIGGER', found type enum('TABLE'). 2017-04-27T08:58:04.198868Z 0 [ERROR] Column count of performance_schema.table_lock_waits_summary_by_table is wrong. Expected 68, found 73. Created with MySQL 50616, now running 50717. Please use mysql_upgrade to fix this error. 2017-04-27T08:58:04.198960Z 0 [ERROR] Column count of performance_schema.threads is wrong. Expected 17, found 14. Created with MySQL 50616, now running 50717. Please use mysql_upgrade to fix this error. 2017-04-27T08:58:04.199045Z 0 [ERROR] Column count of performance_schema.events_stages_current is wrong. Expected 12, found 10. Created with MySQL 50616, now running 50717. Please use mysql_upgrade to fix this error. 2017-04-27T08:58:04.199128Z 0 [ERROR] Column count of performance_schema.events_stages_history is wrong. Expected 12, found 10. Created with MySQL 50616, now running 50717. Please use mysql_upgrade to fix this error. 2017-04-27T08:58:04.199211Z 0 [ERROR] Column count of performance_schema.events_stages_history_long is wrong. Expected 12, found 10. Created with MySQL 50616, now running 50717. Please use mysql_upgrade to fix this error. 2017-04-27T08:58:04.199372Z 0 [ERROR] Incorrect definition of table performance_schema.events_stages_summary_by_account_by_event_name: expected column 'USER' at position 0 to have type char(32), found type char(16). 2017-04-27T08:58:04.199461Z 0 [ERROR] Incorrect definition of table performance_schema.events_stages_summary_by_user_by_event_name: expected column 'USER' at position 0 to have type char(32), found type char(16). 2017-04-27T08:58:04.199750Z 0 [ERROR] Column count of performance_schema.events_statements_current is wrong. Expected 41, found 40. Created with MySQL 50616, now running 50717. Please use mysql_upgrade to fix this error. 2017-04-27T08:58:04.199885Z 0 [ERROR] Column count of performance_schema.events_statements_history is wrong. Expected 41, found 40. Created with MySQL 50616, now running 50717. Please use mysql_upgrade to fix this error. 2017-04-27T08:58:04.200013Z 0 [ERROR] Column count of performance_schema.events_statements_history_long is wrong. Expected 41, found 40. Created with MySQL 50616, now running 50717. Please use mysql_upgrade to fix this error. 2017-04-27T08:58:04.200196Z 0 [ERROR] Incorrect definition of table performance_schema.events_statements_summary_by_account_by_event_name: expected column 'USER' at position 0 to have type char(32), found type char(16). 2017-04-27T08:58:04.200296Z 0 [ERROR] Incorrect definition of table performance_schema.events_statements_summary_by_user_by_event_name: expected column 'USER' at position 0 to have type char(32), found type char(16). 2017-04-27T08:58:04.200609Z 0 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_program' has the wrong structure 2017-04-27T08:58:04.200651Z 0 [ERROR] Native table 'performance_schema'.'events_transactions_current' has the wrong structure 2017-04-27T08:58:04.200687Z 0 [ERROR] Native table 'performance_schema'.'events_transactions_history' has the wrong structure 2017-04-27T08:58:04.200723Z 0 [ERROR] Native table 'performance_schema'.'events_transactions_history_long' has the wrong structure 2017-04-27T08:58:04.200762Z 0 [ERROR] Native table 'performance_schema'.'events_transactions_summary_by_thread_by_event_name' has the wrong structure 2017-04-27T08:58:04.200800Z 0 [ERROR] Native table 'performance_schema'.'events_transactions_summary_by_account_by_event_name' has the wrong structure 2017-04-27T08:58:04.200838Z 0 [ERROR] Native table 'performance_schema'.'events_transactions_summary_by_user_by_event_name' has the wrong structure 2017-04-27T08:58:04.200883Z 0 [ERROR] Native table 'performance_schema'.'events_transactions_summary_by_host_by_event_name' has the wrong structure 2017-04-27T08:58:04.200921Z 0 [ERROR] Native table 'performance_schema'.'events_transactions_summary_global_by_event_name' has the wrong structure 2017-04-27T08:58:04.201002Z 0 [ERROR] Incorrect definition of table performance_schema.users: expected column 'USER' at position 0 to have type char(32), found type char(16). 2017-04-27T08:58:04.201083Z 0 [ERROR] Incorrect definition of table performance_schema.accounts: expected column 'USER' at position 0 to have type char(32), found type char(16). 2017-04-27T08:58:04.201576Z 0 [ERROR] Native table 'performance_schema'.'memory_summary_global_by_event_name' has the wrong structure 2017-04-27T08:58:04.201621Z 0 [ERROR] Native table 'performance_schema'.'memory_summary_by_account_by_event_name' has the wrong structure 2017-04-27T08:58:04.201676Z 0 [ERROR] Native table 'performance_schema'.'memory_summary_by_host_by_event_name' has the wrong structure 2017-04-27T08:58:04.201715Z 0 [ERROR] Native table 'performance_schema'.'memory_summary_by_thread_by_event_name' has the wrong structure 2017-04-27T08:58:04.201755Z 0 [ERROR] Native table 'performance_schema'.'memory_summary_by_user_by_event_name' has the wrong structure 2017-04-27T08:58:04.201791Z 0 [ERROR] Native table 'performance_schema'.'table_handles' has the wrong structure 2017-04-27T08:58:04.201827Z 0 [ERROR] Native table 'performance_schema'.'metadata_locks' has the wrong structure 2017-04-27T08:58:04.201864Z 0 [ERROR] Native table 'performance_schema'.'replication_connection_configuration' has the wrong structure 2017-04-27T08:58:04.201898Z 0 [ERROR] Native table 'performance_schema'.'replication_group_members' has the wrong structure 2017-04-27T08:58:04.201934Z 0 [ERROR] Native table 'performance_schema'.'replication_connection_status' has the wrong structure 2017-04-27T08:58:04.201969Z 0 [ERROR] Native table 'performance_schema'.'replication_applier_configuration' has the wrong structure 2017-04-27T08:58:04.202003Z 0 [ERROR] Native table 'performance_schema'.'replication_applier_status' has the wrong structure 2017-04-27T08:58:04.202041Z 0 [ERROR] Native table 'performance_schema'.'replication_applier_status_by_coordinator' has the wrong structure 2017-04-27T08:58:04.202077Z 0 [ERROR] Native table 'performance_schema'.'replication_applier_status_by_worker' has the wrong structure 2017-04-27T08:58:04.202118Z 0 [ERROR] Native table 'performance_schema'.'replication_group_member_stats' has the wrong structure 2017-04-27T08:58:04.202153Z 0 [ERROR] Native table 'performance_schema'.'prepared_statements_instances' has the wrong structure 2017-04-27T08:58:04.202192Z 0 [ERROR] Native table 'performance_schema'.'user_variables_by_thread' has the wrong structure 2017-04-27T08:58:04.202227Z 0 [ERROR] Native table 'performance_schema'.'status_by_account' has the wrong structure 2017-04-27T08:58:04.202260Z 0 [ERROR] Native table 'performance_schema'.'status_by_host' has the wrong structure 2017-04-27T08:58:04.202294Z 0 [ERROR] Native table 'performance_schema'.'status_by_thread' has the wrong structure 2017-04-27T08:58:04.202332Z 0 [ERROR] Native table 'performance_schema'.'status_by_user' has the wrong structure 2017-04-27T08:58:04.202366Z 0 [ERROR] Native table 'performance_schema'.'global_status' has the wrong structure 2017-04-27T08:58:04.202400Z 0 [ERROR] Native table 'performance_schema'.'session_status' has the wrong structure 2017-04-27T08:58:04.202434Z 0 [ERROR] Native table 'performance_schema'.'variables_by_thread' has the wrong structure 2017-04-27T08:58:04.202472Z 0 [ERROR] Native table 'performance_schema'.'global_variables' has the wrong structure 2017-04-27T08:58:04.202520Z 0 [ERROR] Native table 'performance_schema'.'session_variables' has the wrong structure 2017-04-27T08:58:04.202654Z 0 [ERROR] Incorrect definition of table mysql.db: expected column 'User' at position 2 to have type char(32), found type char(16). 2017-04-27T08:58:04.202686Z 0 [ERROR] mysql.user has no `Event_priv` column at position 28 2017-04-27T08:58:04.202896Z 0 [ERROR] Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler. 2017-04-27T08:58:04.202987Z 0 [Note] Executing 'SELECT * FROM INFORMATION_SCHEMA.TABLES;' to get a list of tables using the deprecated partition engine. You may use the startup option '--disable-partition-engine-check' to skip this check.  2017-04-27T08:58:04.202999Z 0 [Note] Beginning of list of non-natively partitioned tables 2017-04-27T08:58:04.219168Z 0 [Note] End of list of non-natively partitioned tables 2017-04-27T08:58:04.219316Z 0 [Note] mysqld: ready for connections.

解決方法如下:

1、檢視資料狀態

 [email protected]:/root#ps -ef|grep mysql root      68391  67024  0 16:01 pts/4    00:00:00 mysql -h192.168.22.22 -uloan -px xxxx -P3308 mysql     72949  68459 16 17:55 pts/6    00:00:00 /usr/local/mysql/bin/mysqld --defaults-file=/data/backup/backup-my.cnf root      72980  68459  0 17:55 pts/6    00:00:00 grep --color=auto mysql

2、登入資料庫如下

[email protected]:/data/backup#mysql_upgrade -h192.168.22.22 -u root -p  --force -P3308 sock=/data/backup/mysql3308.sock mysql_upgrade: [Warning] Using a password on the command line interface can be insecure. Checking server version. Running queries to upgrade MySQL server. Checking system database. mysql.columns_priv                                 OK mysql.db                                           OK mysql.engine_cost                                  OK mysql.event                                        OK mysql.func                                         OK mysql.general_log                                  OK mysql.gtid_executed                                OK mysql.ha_health_check                              OK mysql.help_category                                OK mysql.help_keyword                                 OK mysql.help_relation      sys.sys_config                                     OK Upgrade process completed successfully. Checking if update is needed.

3、關閉資料庫

4、啟動資料庫 [email protected]:/data/backup#/usr/local/mysql/bin/mysqld --defaults-file=/data/backup/backup-my.cnf & ---------------------  作者:jerry-89  來源:CSDN  原文:https://blog.csdn.net/eagle89/article/details/68928027  版權宣告:本文為博主原創文章,轉載請附上博文連結!