更新 MySQL:MySQL 守护进程启动失败

更新 MySQL:MySQL 守护进程启动失败

我刚刚在 CentOS 上更新了我的 MySQL yum update。我的网站抛出了一些 MySQL 错误,我发现 MySQL 没有运行:

# /etc/init.d/mysqld start
MySQL Daemon failed to start.
Starting MySQL:  [FAILED]

我收到此错误:

2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) when trying to connect

该文件不存在并且也不在我的/tmp文件夹中。


MySQL 升级错误:

# mysql_upgrade
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck with default connection arguments
mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) when try
ing to connect
FATAL ERROR: Upgrade failed

MySQL 错误日志:

101107 12:52:28 [Warning] /usr/libexec/mysqld: Option '--set-variable' is deprecated. Use --variable-name=value instead.
101107 12:52:28 [Note] Plugin 'ndbcluster' is disabled.
/usr/libexec/mysqld: Table 'mysql.plugin' doesn't exist
101107 12:52:28 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
101107 12:52:28  InnoDB: Started; log sequence number 0 30688749
101107 12:52:28 [ERROR] /usr/libexec/mysqld: unknown option '--skip-bdb'
101107 12:52:28 [ERROR] Aborting

101107 12:52:28  InnoDB: Starting shutdown...
101107 12:52:34  InnoDB: Shutdown completed; log sequence number 0 30688749
101107 12:52:34 [Note] /usr/libexec/mysqld: Shutdown complete

101107 12:52:34 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

第二次:

101107 12:52:34 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
101107 13:19:44 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
101107 13:19:44 [Warning] option 'innodb-additional-mem-pool-size': signed value 204800 adjusted to 524288
101107 13:19:44 [Warning] option 'innodb-log-buffer-size': signed value 204800 adjusted to 262144
101107 13:19:44 [Note] Plugin 'ndbcluster' is disabled.
/usr/libexec/mysqld: Table 'mysql.plugin' doesn't exist
101107 13:19:44 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
101107 13:19:44  InnoDB: Started; log sequence number 0 30688749
101107 13:19:44 [ERROR] /usr/libexec/mysqld: unknown option '--skip-bdb'
101107 13:19:44 [ERROR] Aborting

101107 13:19:44  InnoDB: Starting shutdown...
101107 13:19:49  InnoDB: Shutdown completed; log sequence number 0 30688749
101107 13:19:49 [Note] /usr/libexec/mysqld: Shutdown complete

101107 13:19:49 mysqld_safe mysqld from pid file /var/lib/mysql/dev.system.de.pid ended

这些是我记录的最新错误。


$ mysql_upgrade
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck with default connection arguments
mysqlcheck: Got error: 1045: Access denied for user 'root'@'localhost' (using password: NO) when trying to connect
FATAL ERROR: Upgrade failed

答案1

首先在你的 my.cnf 中

消除 ‘--skip-bdb’

尝试再次启动 /etc/init.d/mysqld start

似乎你已经升级到了较新的版本 5.1,因此你需要在服务器运行后运行 mysql_upgrade

答案2

在 my.cnf(/etc/mysql/my.conf 或 /etc/my.cnf)中查找 log_error 指令,找出错误记录的位置。在 Ubuntu 上,默认为 /var/log/mysql/error.log,您的系统上可能有所不同。查看那里以查看 mysql 服务器在抱怨什么。

相关内容