不知道是不是每次更新 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 软件包之后都需要进行类似的数据库升级操作。

mysql重启遇到的问题的更多相关文章

  1. 各个平台的mysql重启命令

    linux平台及windows平台mysql重启方法 Linux下重启MySQL的正确方法: 1.通过rpm包安装的MySQL service mysqld restart 2.从源码包安装的MySQ ...

  2. Centos上Apache重启,mysql重启,nginx重启方法

    转载:http://www.3lian.com/edu/2012/04-01/24278.html Centos上Apache重启,mysql重启, nginx 重启方法 1.重启 apache se ...

  3. linux平台及windows平台mysql重启方法

    各个平台mysql 重启: inux平台及windows平台mysql重启方法 Linux下重启MySQL的正确方法: 1.通过rpm包安装的MySQL service mysqld restart ...

  4. 【MySQL】Mac通过brew安装的MySQL重启方法

    问题 在 Mac 上通过 brew install mysql 安装的的MySQL使用基本MySQL命令重启会失败: mysql.server stop mysql.server start mysq ...

  5. 数据库安装后无法访问且mysql重启报错的解决方法

    数据库安装后无法访问,mysql重启报错: 或报错:MySQL is running but PID file could not be found 解决方法: 第一种方法:看磁盘是否已满:df –h ...

  6. Ubuntu学习总结-12 linux 平台及 windows 平台 mysql 重启方法

    一 Linux下重启MySQL的正确方法 1.通过rpm包安装的MySQL   service mysqld restart2.从源码包安装的MySQL   // linux关闭MySQL的命令$my ...

  7. set global show_compatibility_56 = on;永久生效MySQL重启

    1. 找到MySQL的配置文件,一般在MySQL的安装目录下,例如我的: C:\Program Files\MySQL\MySQL Server 5.7 ,打开下面的一个配置文件: my-defaul ...

  8. windows环境下MySQL重启的命令行说明

    ctrl+r 弹出运行框,输入cmd,然后再控制太输入命令: 1.点击“开始”->“运行”(快捷键Win+R). 2.停止:输入 net stop mysql 3.启动:输入 net start ...

  9. Centos上Apache重启,mysql重启, nginx 重启方法

    1.重启 apache service httpd restrat /etc/init.d/httpd stop /etc/init.d/httpd start 2.重启 mysql service ...

  10. 利用 force recovery 解决服务器 crash 导致 MySQL 重启失败的问题

    小明同学在本机上安装了 MySQL 5.7.17 配合项目进行开发,并且已经有了一部分重要数据.某天小明在开发的时候,需要出去一趟就直接把电脑关掉了,没有让 MySQL 正常关闭,重启 MySQL 的 ...

随机推荐

  1. miniui处理多重子表级联,一次性提交多表数据的ui要点

    在一个ui界面上 有a,b,c三个表 a表只有一条记录,b表有多条记录,c表有多条记录 b是a的子表,c是b的子表 都是一对多关系 一次性下载相关联的c表记录 然后mini-datagrid采用cli ...

  2. C# 中使用OPenCV(Emgu)心得

    原文:C# 中使用OPenCV(Emgu)心得 首先介绍一下自己的情况,2010年的3月份开始接触学习C#编程,之前C#和OpenCV都是零基础,由于全都是自学进度比较慢,中间也走了不少弯路.进过三个 ...

  3. Android零基础入门第38节:初识Adapter

    原文:Android零基础入门第38节:初识Adapter 在上一节一起了解了ListView的简单使用,那么本节继续来学习与ListView有着千丝万缕的Adapter. 一.了解MVC模式 在开始 ...

  4. 升级d7的代码到2010以上版本注意事项(SetLength的参数就是字符长度,而不是字节长度,但Move函数要改)

    delphi2010是delphi所有版本的分水岭,其中2010—xe10.2之间版本上的代码都有比较好的兼容性,基本上都能直接进行编译,不需要过多修改,但d7距d2010跨度4个版本以上,新版本除了 ...

  5. 更改当前电源策略(使用SetActivePwrScheme API函数),自定义电源按钮动作(设置GLOBAL_POWER_POLICY)

    #include <windows.h> #include <Powrprof.h> #pragma comment(lib, "Powrprof.lib" ...

  6. MASM 命令行编译方法

    假设有一个t est.asm ,一个test.rc 可以在CMD里这么编译: ml /c /coff test.asm rc test.rc link /subsystem:windows test. ...

  7. 地球坐标-火星坐标-百度坐标及之间的转换算法 C#

    美国GPS使用的是WGS84的坐标系统,以经纬度的形式来表示地球平面上的某一个位置.但在我国,出于国家安全考虑,国内所有导航电子地图必须使 用国家测绘局制定的加密坐标系统,即将一个真实的经纬度坐标加密 ...

  8. Codility---MaxProductOfThree

    Task description A non-empty zero-indexed array A consisting of N integers is given. Theproduct of t ...

  9. spring常见十大异常

    一.找不到配置文件的异常 [plain] view plaincopy org.springframework.beans.factory.BeanDefinitionStoreException:  ...

  10. 简单学习js

    由于是个前端小白,通过这一两天的学习html,css,js和jquery等,基本上前端会用了,而且熟悉我博客的人来说,没错,我把自己的博客给优化了一下(一些大佬都是禁用模板的所有样式,然后自己设计页面 ...