deepvps昨天在Webmin后台看到有Mysql最新版本升级,就顺手点了升级。一般情况下Webmin的软件升级很容易,都是在后台点升级后自动升级完成的。但是昨天没想到Mysql升级完后居然不能启动,提示启动失败。

错误提示如下:

无法启动数据库 :
MySQL Daemon failed to start.
Starting mysqld:  [FAILED]


deepvps查看了Mysql的启动日志,显示如下:

101014 13:56:50 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
101014 14:01:54 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
101014 14:01:54 [Note] Plugin ‘InnoDB’ is disabled.
/usr/libexec/mysqld: Table ‘mysql.plugin’ doesn’t exist
101014 14:01:54 [ERROR] Can’t open the mysql.plugin table. Please run mysql_upgrade to create it.
101014 14:01:54 [ERROR] /usr/libexec/mysqld: unknown option ‘–skip-bdb’
101014 14:01:54 [ERROR] Aborting

101014 14:01:54 [Note] /usr/libexec/mysqld: Shutdown complete

101014 14:01:54 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
101014 14:02:57 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
101014 14:02:57 [Note] Plugin ‘InnoDB’ is disabled.
/usr/libexec/mysqld: Table ‘mysql.plugin’ doesn’t exist
101014 14:02:57 [ERROR] Can’t open the mysql.plugin table. Please run mysql_upgrade to create it.
101014 14:02:57 [ERROR] /usr/libexec/mysqld: unknown option ‘–skip-bdb’
101014 14:02:57 [ERROR] Aborting

101014 14:02:57 [Note] /usr/libexec/mysqld: Shutdown complete

通过启动日志的错误提示,deepvps在Google一顿搜索,终于搞明白了错误的原因。Mysql从5.0升级到5.1的时候,数据库的结构发生了一些变化,而Webmin 在升级Mysql的时候,升级不完全所以导致了Mysql在升级收启动失败的问题。

现在我们只能通过手动的方法修复这个问题了:

1,修改不兼容的数据库参数

在最新的Mysql 5.1.50版中已经废除了skip-bdb参数。所以现在我们需要在Mysql的配置文件里面删除这个参数。而skip-locking改为了skip-external-locking,skip-innodb改为了loose-skip-innodb。

首先进入/etc 目录,编辑my.cnf
命令:先cd /etc
再输入 vi my.cnf

在[mysqld]下面删除以下三行:

skip-locking
skip-bdb
skip-innodb

加入以下两行:

skip-external-locking
loose-skip-innodb

2,修改完参数后,Mysql数据库应该就可以启动了,然后进行第2步的修改。

最新的Mysql 5.1.50版实现了支持无需重启服务器就能在运行时加载或卸载API插件。这个特性需要用到mysql.plugin表,可以运行 “mysql_upgrade” 命令来创建该表 。

3,最后在Mysql命令行方式下运行,”mysql_repair” 命令修复整个数据库,这样就算彻底解决了Mysql数据库升级失败的问题了。

现在我们在来看一下Mysql的日志:

101014 21:54:39 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
101014 21:54:41 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
101014 21:54:41 [Note] Plugin ‘InnoDB’ is disabled.
101014 21:54:43 [Note] Event Scheduler: Loaded 0 events
101014 21:54:43 [Note] /usr/libexec/mysqld: ready for connections.
Version: ‘5.1.50′ socket: ‘/var/lib/mysql/mysql.sock’ port: 3306 MySQL Community Server (GPL) by Utter Ramblings

可以看到已经没有任何问题了,Mysql运行正常,问题解决。^_^

原创文章如转载,请注明:转载自深度VPS [ http://www.deepvps.com ] 
[复制本文链接发送给您的好友]
arrow
arrow
    全站熱搜

    戮克 發表在 痞客邦 留言(0) 人氣()