MySQL 守护进程启动失败

MySQL 守护进程启动失败

我尝试在多个网站上寻找解决此错误的办法,并在 serverfault 上询问其他问题。但没有人能帮我修复此错误。

MySQL 一直运行良好,直到我将以下内容添加到 my.cnf 中:

[client]
socket=/var/lib/mysql/mysql.sock

重新启动 MySQL 后,我收到错误:

MySQL Daemon failed to start.
Starting mysqld:                                           [FAILED]

我尝试删除我添加到 my.cnf 的内容,然后尝试启动 MySQL,但它仍然无法启动。我检查了 mysql.sock 是否在 /var/lib/mysql/ 中,但没有。我尝试添加一个空白的 mysql.sock 文件,将其 chown 为 mysql,并将其 chmod 设置为 4777。它仍然无法启动。

我也尝试过删除和更新 mysql 和 mysql-server,但都没有用。似乎都不起作用,所以我来这里看看你们是否有其他可能有用的建议。

是的,问题显然是 mysql.sock 不存在,但我应该如何正确添加它,或者有没有办法让 MySQL 创建它?

下面是我尝试启动 MySQL 以及 my.cnf 配置文件的日志文件:

110608 16:07:05 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
110608 16:07:05 [ERROR] Error message file '/usr/share/mysql/english/errmsg.sys' had only 480 error messages,
but it should contain at least 709 error messages.
Check that the above file is the right version for this program!
110608 16:07:05 [Note] Plugin 'FEDERATED' is disabled.
/usr/libexec/mysqld: Unknown error 1146
110608 16:07:05 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
110608 16:07:05 InnoDB: The InnoDB memory heap is disabled
110608 16:07:05 InnoDB: Mutexes and rw_locks use GCC atomic builtins
110608 16:07:05 InnoDB: Compressed tables use zlib 1.2.3
110608 16:07:05 InnoDB: Using Linux native AIO
110608 16:07:05 InnoDB: Initializing buffer pool, size = 128.0M
110608 16:07:05 InnoDB: Completed initialization of buffer pool
110608 16:07:05 InnoDB: highest supported file format is Barracuda.
110608 16:07:05  InnoDB: Waiting for the background threads to start
110608 16:07:06 InnoDB: 1.1.7 started; log sequence number 1595675
110608 16:07:06 [ERROR] Aborting

110608 16:07:06  InnoDB: Starting shutdown...
110608 16:07:07  InnoDB: Shutdown completed; log sequence number 1595675
110608 16:07:07 [Note]
110608 16:07:07 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

mysql_升级:

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

我的.cnf:

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[client]
socket=/var/lib/mysql/mysql.sock

谢谢。

答案1

第一个错误是“[错误] 错误消息文件‘/usr/share/mysql/english/errmsg.sys’”,你应该处理它。尝试阅读这个帖子

答案2

以 root 身份删除文件 /var/lib/mysql/mysql.sock 并运行以下命令:

chown mysql:mysql /var/lib/mysql
chmod 700 /var/lib/mysql
chkconfig --level 345 mysql on
service mysqld start

答案3

阅读完其他人的所有提示后:您是否绝对确定客户端套接字添加是 MySQL 重启之间的唯一变化?

我也有自己的经历,“嘿,伙计们,这是仅有的我发誓我做了改变”的情况;经过一番思考后,我发现了一些类似“哎呀。我一个星期前升级了发行版包,之后忘了重启 MySQL”或“我只是对这个其他配置文件做了一点小小的改动”的情况。然后,当我尝试重新启动某些服务时,它无法启动,只有相当一部分调试才有帮助……

如果您从 my.cnf 中注释掉套接字行,会有帮助吗?

另外,SELinux 启用了吗?setenforce 0如果启用了,请尝试一下。

答案4

听起来你从 5.5 之前版本升级到了 5.5..

您必须使用 --skip-grant-tables 启动 mysql,然后运行

mysql_upgrade

现在,对于 errmsg.sys,在编译或安装的位置找到它并将其移动到

/usr/share/mysql/english/errmsg.sys

相关内容