service mysqld restart
确认版本信息:
[root@west195246 bin]# mysql -V
mysql Ver 14.14 Distrib 5.6.20, for Linux (x86_64) using EditLine wrapper
在我进行过的几次软件升级之后,总会在 MySQL 的日志中见到“[ERROR] Missing system table mysql.proxies_priv; please run mysql_upgrade to create it”之类的错误。虽然这个错误修复起来很简单,却不容易引起注意。可以按如下方法修复:
错误日志如下:
[ERROR] InnoDB: auto-extending data file ./ibdata1 is of a different> 2017-09-01 09:15:06 5588 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
2017-09-01 09:15:06 5588 [ERROR] Plugin 'InnoDB' init function returned error.
2017-09-01 09:15:06 5588 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-09-01 09:15:06 5588 [ERROR] Unknown/unsupported storage engine: InnoDB
2017-09-01 09:15:06 5588 [ERROR] Aborting
错误提示如下:
[ERROR] Missing system table mysql.proxies_priv; please run mysql_upgrade to create it
[ERROR] Native table 'performance_schema'.'events_waits_current' has the wrong structure
[ERROR] Native table 'performance_schema'.'events_waits_history' has the wrong structure
[ERROR] Native table 'performance_schema'.'events_waits_history_long' has the wrong structure
[ERROR] Native table 'performance_schema'.'setup_consumers' has the wrong structure
[ERROR] Native table 'performance_schema'.'setup_instruments' has the wrong structure
[ERROR] Native table 'performance_schema'.'setup_timers' has the wrong structure
[ERROR] Native table 'performance_schema'.'performance_timers' has the wrong structure
[ERROR] Native table 'performance_schema'.'threads' has the wrong structure
[ERROR] Native table 'performance_schema'.'events_waits_summary_by_thread_by_event_name' has the wrong structure
[ERROR] Native table 'performance_schema'.'events_waits_summary_by_instance' has the wrong structure
[ERROR] Native table 'performance_schema'.'events_waits_summary_global_by_event_name' has the wrong structure
[ERROR] Native table 'performance_schema'.'file_summary_by_event_name' has the wrong structure
[ERROR] Native table 'performance_schema'.'file_summary_by_instance' has the wrong structure
[ERROR] Native table 'performance_schema'.'mutex_instances' has the wrong structure
[ERROR] Native table 'performance_schema'.'rwlock_instances' has the wrong structure
[ERROR] Native table 'performance_schema'.'cond_instances' has the wrong structure
[ERROR] Native table 'performance_schema'.'file_instances' has the wrong structure
[Note] Event Scheduler: Loaded 0 events
[Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.20-log' socket: '/var/lib/mysql/mysql.sock' port: 0
处理方法:
#cd /var/lib/mysql
#rm -rf ib*
#service mysqld restart
需要按照如下的格式在 Linux 的 —— 而不是 MySQL 的 —— 命令提示符下运行:
#mysql_upgrade -u root -p
然后根据提示输入 mysql 的 root 帐户密码,修复过程就可自动运行。此时会有如下形式的提示信息输出:
mysql_upgrade -u root -p
Enter password:
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/lib/mysql/mysql.sock'
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/lib/mysql/mysql.sock'
wp_commentmeta OK
wp_comments OK
wp_links OK
wp_options OK
wp_postmeta OK
wp_posts OK
wp_term_relationships OK
wp_term_taxonomy OK
wp_terms OK
wp_usermeta OK
wp_users OK
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.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.servers 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
Running 'mysql_fix_privilege_tables'... OK
##service mysqld restart