首先贴上实验用各版本:

OS:CentOS 6.5

MySQL:

mysql> select version ();
+------------+
| version () |
+------------+
| 5.6.22     |
+------------+
1 row in set (0.00 sec)

事情是这样的:本来是要在虚机上搭建一个wordpress做实验,刚创建完数据库,就在赋权额时候发生不在计划的错误:

mysql>grant all on wordpress.* to wordpress@localhost identified by "wp123456";

ERROR 2013 (HY000): Lost connection to MySQL server during query

查看报错日志如下:tail -fn 30 /var/log/mysqld.log

2016-11-15 12:56:22 112085 [ERROR] Missing system table mysql.proxies_priv; please run mysql_upgrade to create it

2016-11-15 12:56:22 112085 [ERROR] Native table 'performance_schema'.'cond_instances' has the wrong structure

2016-11-15 12:56:22 112085 [ERROR] Native table 'performance_schema'.'events_waits_current' has the wrong structure

2016-11-15 12:56:22 112085 [ERROR] Native table 'performance_schema'.'events_waits_history' has the wrong structure

2016-11-15 12:56:22 112085 [ERROR] Native table 'performance_schema'.'events_waits_history_long' has the wrong structure

    看报错日志一直在提示wrong structure(结构错误),通常结构错误是由升级MySQL版本导致的,我虽然没有升级,但是在安装MySQL5.6.22前,安装的是5.1版本,可能是由于卸除的不干净(但是之前在赋权时并没有此问题,疑惑??),看了网上N多方法,但是对于我的问题就是不感冒啊!突然在网上看到一个升级脚本修复的例子,就想着我的是不是也适用(因为我之前装过旧版本),所以就试了一下果然OK啊!看到成功那一刻,一扫额头阴霾O(∩_∩)O~

    执行升级脚本命令:

/usr/local/mysql/bin/mysql_upgrade -u root -p

输入密码后回车,再次赋权成功啦,哇咔咔..........

wKioL1gqxgKhfSrTAADe8f3cVx0562.png-wh_50

mysql> grant all on wordpress.* to wordpress@localhost identified by "wp123456";
Query OK, 0 rows affected (0.00 sec)