Can't open the mysql.plugin table. Please run mysql_upgrade to create it

1.版本

1)操作系统

 cat /etc/issue
Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Kernel \r on an \m

 cat /proc/version
Linux version 2.6.32-504.el6.x86_64 (mockbuild@c6b9.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) ) #1 SMP Wed 

2)mysql数据库版本

mysql --version
mysql  Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1


2.错误描述

  今天启动一套5.1的mysql数据库的时候发现如下报错:

151202 18:38:02 mysqld_safe Starting mysqld daemon with databases from /data/mysql
/usr/libexec/mysqld: Table 'mysql.plugin' doesn't exist
151202 18:38:02 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
151202 18:38:02  InnoDB: Initializing buffer pool, size = 3.9G
151202 18:38:03  InnoDB: Completed initialization of buffer pool
151202 18:38:03  InnoDB: Started; log sequence number 0 983066381
151202 18:38:04 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
151202 18:38:04 [ERROR] Column count of mysql.db is wrong. Expected 22, found 20. Created with MySQL 50157, now running 50173. Please use mysql_upgrade to fix this error.
151202 18:38:04 [ERROR] mysql.user has no `Event_priv` column at position 29
151202 18:38:04 [ERROR] Cannot open mysql.event
151202 18:38:04 [ERROR] Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.
151202 18:38:04 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.73-log'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution


3.问题分析

  具体是什么原因导致启动的时候报这些错误,还不知道


4.解决方案

1).根据error中的提示 我们可以使用mysql_upgrade来修复问题

mysql_upgrade --protocol=tcp -P3306 -p

输出如下:(截取部分)

mysql_upgrade --protocol=tcp -P3306 -p
Enter password: 
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck' with connection arguments: '--protocol=tcp' '--port=3306' 
Running 'mysqlcheck' with connection arguments: '--protocol=tcp' '--port=3306' 
ccdb5.ScalingGroup                                 OK
ccdb5.cAdmin                                       OK
ccdb5.cAlarm                                       OK
ccdb5.cApp                                         OK
ccdb5.cAuth                                        OK
ccdb5.cCluster                                     OK
ccdb5.cContainerType                               OK
ccdb5.cCvmInstance                                 OK
ccdb5.cCvmInstanceECC                              OK
ccdb5.cDevice                                      OK
ccdb5.cDirtyAgentConf                              OK
.......................................................
.......................................................

2).重启mysql实例

mysqladmin -uroot -p -S /var/lib/mysql/mysql.sock shutdown

mysqld_safe --defaults-file=/etc/my.cnf &

启动时errolog日志截取如下:

151202 19:26:27 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
151202 19:26:54 mysqld_safe Starting mysqld daemon with databases from /data/mysql
151202 19:26:54  InnoDB: Initializing buffer pool, size = 3.9G
151202 19:26:54  InnoDB: Completed initialization of buffer pool
151202 19:26:55  InnoDB: Started; log sequence number 0 983066391
151202 19:26:55 [Note] Event Scheduler: Loaded 0 events
151202 19:26:55 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.73-log'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution
##可见错误已经修复

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

渔夫数据库笔记

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值