尝试启动 MySQL 守护程序时发生超时错误。 CentOS 5

Posted

技术标签:

【中文标题】尝试启动 MySQL 守护程序时发生超时错误。 CentOS 5【英文标题】:Timeout error occurred trying to start MySQL Daemon. CentOS 5 【发布时间】:2012-02-08 04:59:41 【问题描述】:

我在 CentOS 上遇到了 mysql 问题。 我遇到了一些问题并备份了我的数据库并删除了所有依赖项的 mysql。 之后我重新安装了:

 yum groupinstall "MySQL Database"

安装没有错误。

运行 mysql 守护进程:

service mysqld start

Timeout error occurred trying to start MySQL Daemon.
Starting MySQL:                                            [FAILED]

我也跑了

# /usr/bin/mysql_install_db --user=mysql
Installing MySQL system tables...
120112  1:49:44 [ERROR] Error message file '/usr/share/mysql/english/errmsg.sys'  had only 480 error messages,
but it should contain at least 481 error messages.
Check that the above file is the right version for this program!
120112  1:49:44 [ERROR] Aborting

Installation of system tables failed!

Examine the logs in /var/lib/mysql for more information.
You can try to start the mysqld daemon with:
/usr/libexec/mysqld --skip-grant &
and use the command line tool
/usr/bin/mysql to connect to the mysql
database and look at the grant tables:

shell> /usr/bin/mysql -u root mysql
mysql> show tables

Try 'mysqld --help' if you have problems with paths. Using --log
gives you a log in /var/lib/mysql that may be helpful.

The latest information about MySQL is available on the web at
http://www.mysql.com
Please consult the MySQL manual section: 'Problems running mysql_install_db',
and the manual section that describes problems on your OS.
Another information source is the MySQL email archive.
Please check all of the above before mailing us!
And if you do mail us, you MUST use the /usr/bin/mysqlbug script!

检查日志:

less /var/log/mysqld.log

日志文件为空。我什至不知道如何调试它,也不知道该怎么做。

有什么建议吗?

谢谢

【问题讨论】:

【参考方案1】:

我知道您很久以前就问过这个问题,但是由于搜索“尝试启动 MySQL 守护程序时发生超时错误。”的人可能会在这里结束,有几种可能的解决方案来解决该错误.以下是其中一些:

首先,不要运行service mysqld startservice mysqld restart,而是尝试运行:

$ service mysqld stop; mysqld_safe &

/etc/init.d/mysqld 脚本中的 mysqladmin 行存在已知问题。

如果这不起作用,请尝试以下操作:检查是否有足够的可用磁盘空间(尤其是在 /var 中):

$df -h

检查这些文件中可能存在的错误消息(可能并非所有文件都存在):

# tail -n 30 /var/log/messages

# tail -n 30 /var/log/mysqld.log

# tail -n 30 /var/lib/mysql/*.err

# tail -n 30 /var/log/mysql/error.log

接下来,确保/etc/my.cnf 使用...

socket=/var/lib/mysql/mysql.sock

...并且目录/var/lib/mysql/ 确实存在。

设置正确的权限和所有权:

# chown -R mysql.mysql /var/lib/mysql/

# chmod g+w /var/run/mysqld/

# chgrp mysql /var/run/mysqld/

还是不行?尝试将my.cnf 中的绑定地址更改为 127.0.0.1 或 0.0.0.0,或注释掉该行。

如果您仍然不走运,请搜索有关 mysql_install_db 的更多信息,由于您的 InnoDB 数据库可能已损坏,请查看 set-variable=innodb_force_recovery=6

【讨论】:

【参考方案2】:

嘿,有时这是因为您的磁盘空间不足...所以请运行一个粗略的df -h 以确保! (这只是发生在我身上:P)。

【讨论】:

会在第 4 小时之前想到这一点!谢谢!【参考方案3】:

在启动mysql服务器之前重命名文件/var/lib/mysql/ib_logfile0/var/lib/mysql/ib_logfile0然后重启服务器

在 linux/unix 中

mv /var/lib/mysql/ib_logfile0  /var/lib/mysql/ib_logfile0_old
mv /var/lib/mysql/ib_logfile1  /var/lib/mysql/ib_logfile1_old

然后

service mysqld restart

【讨论】:

虽然下面的答案有更多选择,但这是对我有用的一个。谢谢!【参考方案4】:

在我的情况下,原因是我在 /etc/my.cnf 中设置了 key_buffer_size,当我将其注释掉时,mysqld 启动正常。

【讨论】:

【参考方案5】:

试试这个:

rm $(grep socket /etc/my.cnf | cut -d= -f2)  && service mysqld start

【讨论】:

以上是关于尝试启动 MySQL 守护程序时发生超时错误。 CentOS 5的主要内容,如果未能解决你的问题,请参考以下文章

当我尝试在设备上部署 PhoneGAP 应用程序时,xCode 返回“等待应用程序启动超时”错误

将文件 sql 导入 cpanel 服务器上的 phpmyadmin 时发生超时错误

守护程序中的 Doctrine2 连接超时

从作为守护进程启动的应用程序打开外部应用程序

sqlalchemy + MySQL 连接超时

java.lang.AssertionError:Cassandra守护程序未在超时内启动