不知道是不是每次更新 MySQL 软件之后都需要执行数据库升级指令?在我进行过的几次软件升级之后,总会在 MySQL 的日志中见到

“[ERROR] Missing system table mysql.proxies_priv; please run mysql_upgrade to create it”之类的错误。虽然这个错误修复起来很简单,却不容易引起注意。
1. 错误描述
我在好几次见到这样的错误提示之后才决定好好看看到底写了些什么。因为网站运行很正常,就心想应该不怎么重要吧。错误提示大致内容如下(已将前导的日期时间略去):

[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

有时候可能还会多点儿如下内容:

[ERROR] Incorrect definition of table mysql.proc: expected column 'comment' at position 15 to have type text, found type char(64).

一般看到结尾提示个 ready for connections 一般也就没心思去看前面都提示了什么东西了。我也是有一次在 x86_64 位 CentOS 中的 MySQL 日志中见到了多出来的这个 ERROR 信息才决定好好看看的前面的错误提示的。(我是运行在 32 位 CentOS 上的。)
可是见到错误提示句子结构都差不多就没有仔细往前翻,所以我开始还重新安装了一遍 MySQL 软件包。后来才看到每次执行
service mysql restart
重起 MySQL服务的时候都会出现这样的错误提示。然后该错误提示开头还说了,让执行
mysql_upgrade
指令来修复。才恍然大悟,估计是升级了 MySQL 的软件包,管理数据库的某些表结构发生了变化,所以还需要升级数据库的相关表结构。
2. 修复

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

看来每次在 Linux 中升级了 MySQL 软件包之后都需要进行类似的数据库升级操作。

最新文章

  1. 如何启动一个Java Web应用
  2. Javascript 处理时间大全
  3. 浮点数转换为人名币读法字符串(JAVA)
  4. 014安装Linux系统到开发板
  5. 使用FTP搭建YUM
  6. java如何判断字符串是否为空的方法
  7. 2014ACM/ICPC亚洲区鞍山赛区现场赛1009Osu!
  8. SpringMVC集成shrio框架
  9. MySQL数据库Raid存储方案
  10. 防盗链与token运用
  11. 面试真题--------spring源码解析IOC
  12. linux系统裁剪
  13. css3动画的简单学习
  14. 创建一个简单的WCF程序2——手动开启/关闭WCF服务与动态调用WCF地址
  15. CentOS7 安装PHP7的redis扩展:
  16. 【Python爬虫实战】微信爬虫
  17. POJ2227(优先队列)
  18. 12月10日 render( locals:{...}) 传入本地变量。
  19. springmvc中@RequestMapping的使用
  20. PAT 甲级 1004 Counting Leaves

热门文章

  1. String的本质是一个char*,只是以类的形式提供,使用起来比较方便
  2. 展讯通信:文章"紫光收购后展讯困难重重”失实(展讯的成就确实很高)
  3. 零元学Expression Blend 4 - Chapter 14 用实例了解布局容器系列-「Pathlistbox」II
  4. Dec Working Note
  5. 让您的应用兼容 Android Oreo
  6. Microsoft .NET Framework 3.5 SP1安装错误 1603
  7. =WM_VSCROLL(消息反射) 和 WM_VSCROLL(消息响应)的区别(控件拥有者自己不处这个理消息,而是反射给控件对象本身来处理这个消息)
  8. Delphi使用android的NDK是通过JNI接口,封装好了,不用自己写本地代码,直接调用
  9. 快速开发平台 WebBuilder 8 发布
  10. java集合框架collection(6)继承结构图