本日も乙

ただの自己満足な備忘録。

MySQLをアップデートしたらエラーになったのでmysql_upgradeで直した

今日も飽きずに過去のメモを掘り起こして記事にしようのコーナーです。
メモが色々なところに分散しているので記事にすることで1つにできるのが良いですね。


MySQLyumでインストールしており、yum update mysqlしたらMySQLのログにエラー出ていました。

# /var/log/mysqld.log

2015-06-25 15:12:20 30960 [ERROR] Missing system table mysql.proxies_priv; please run mysql_upgrade to create it
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'cond_instances' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_waits_current' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_waits_history' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_waits_history_long' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_host_by_event_name' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_instance' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_thread_by_event_name' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_user_by_event_name' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_account_by_event_name' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_waits_summary_global_by_event_name' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'file_instances' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'file_summary_by_event_name' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'file_summary_by_instance' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'host_cache' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'mutex_instances' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'objects_summary_global_by_type' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'performance_timers' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'rwlock_instances' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'setup_actors' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'setup_consumers' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'setup_instruments' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'setup_objects' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'setup_timers' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'table_io_waits_summary_by_index_usage' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'table_io_waits_summary_by_table' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'table_lock_waits_summary_by_table' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'threads' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_stages_current' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_stages_history' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_stages_history_long' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_stages_summary_by_thread_by_event_name' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_stages_summary_by_account_by_event_name' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_stages_summary_by_user_by_event_name' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_stages_summary_by_host_by_event_name' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_stages_summary_global_by_event_name' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_statements_current' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_statements_history' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_statements_history_long' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_thread_by_event_name' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_account_by_event_name' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_user_by_event_name' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_host_by_event_name' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_statements_summary_global_by_event_name' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_digest' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'users' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'accounts' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'hosts' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'socket_instances' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'socket_summary_by_instance' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'socket_summary_by_event_name' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'session_connect_attrs' has the wrong structure
2015-06-25 15:12:20 30960 [ERROR] Native table 'performance_schema'.'session_account_connect_attrs' has the wrong structure

ググったら MySQLが繋がらなくなってたので対応した | Shimabox Blog がヒットしました。
mysql_upgradeコマンドを実行すれば良いみたいです。

$ sudo mysql_upgrade -u root -p
Enter password:
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck with default connection arguments
Warning: Using a password on the command line interface can be insecure.
Running 'mysqlcheck with default connection arguments
Warning: Using a password on the command line interface can be insecure.
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.general_log                                  OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.host                                         OK
mysql.innodb_index_stats                           OK
mysql.innodb_table_stats                           OK
mysql.ndb_binlog_index                             OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.servers                                      OK
mysql.slave_master_info                            OK
mysql.slave_relay_log_info                         OK
mysql.slave_worker_info                            OK
mysql.slow_log                                     OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.user                                         OK

念のため、MySQLを再起動して完了です。

$ sudo service mysqld restart