尝试启动 MySQL 守护程序时发生超时错误。CentOS 5
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8826034/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Timeout error occurred trying to start MySQL Daemon. CentOS 5
提问by epema
I ran into troubles with MySQL on my CentOS. I had some problems and backed up my database and removed mysql with all dependencies. After that I ran reinstalled:
我在 CentOS 上遇到了 MySQL 的问题。我遇到了一些问题并备份了我的数据库并删除了所有依赖项的 mysql。之后我运行重新安装:
yum groupinstall "MySQL Database"
Installed without errors.
安装没有错误。
Running the mysql daemon:
运行 mysql 守护进程:
service mysqld start
Timeout error occurred trying to start MySQL Daemon.
Starting MySQL: [FAILED]
I also ran
我也跑了
# /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!
Checking the logs:
检查日志:
less /var/log/mysqld.log
Log file is empty. I don't even know how to debug it and not sure what to do.
日志文件为空。我什至不知道如何调试它,也不知道该怎么做。
Any recommendations?
有什么建议吗?
Thank you
谢谢
回答by Norbert
I know you asked this a long time ago, but since people who search for "Timeout error occurred trying to start MySQL Daemon."may end up here, there are several possible solutions to that error. Here are some of them:
我知道您很久以前就问过这个问题,但是因为搜索“尝试启动 MySQL 守护程序时发生超时错误”的人。可能会在这里结束,该错误有几种可能的解决方案。这里是其中的一些:
First, instead of running service mysqld start
or service mysqld restart
try running:
首先,不要运行service mysqld start
或service mysqld restart
尝试运行:
$ service mysqld stop; mysqld_safe &
$ service mysqld stop; mysqld_safe &
There are known problems with the mysqladmin
lines in the /etc/init.d/mysqld
script.
脚本中的mysqladmin
行存在已知问题/etc/init.d/mysqld
。
If this isn't working, try the following things: check if there is enough free disk space (especially in /var
):
如果这不起作用,请尝试以下操作:检查是否有足够的可用磁盘空间(尤其是在 中/var
):
$ df -h
$ df -h
Check for possible error messages in these files (not all of them may exist):
检查这些文件中可能的错误消息(并非所有文件都存在):
# tail -n 30 /var/log/messages
# tail -n 30 /var/log/messages
# tail -n 30 /var/log/mysqld.log
# tail -n 30 /var/log/mysqld.log
# tail -n 30 /var/lib/mysql/*.err
# tail -n 30 /var/lib/mysql/*.err
# tail -n 30 /var/log/mysql/error.log
# tail -n 30 /var/log/mysql/error.log
Next up, make sure that /etc/my.cnf
uses...
接下来,确保/etc/my.cnf
使用...
socket=/var/lib/mysql/mysql.sock
socket=/var/lib/mysql/mysql.sock
...and that the directory /var/lib/mysql/
actually exists.
...并且该目录/var/lib/mysql/
确实存在。
Set the correct permissions and ownerships:
设置正确的权限和所有权:
# chown -R mysql.mysql /var/lib/mysql/
# chown -R mysql.mysql /var/lib/mysql/
# chmod g+w /var/run/mysqld/
# chmod g+w /var/run/mysqld/
# chgrp mysql /var/run/mysqld/
# chgrp mysql /var/run/mysqld/
Still not working? Try changing the bind-address in my.cnf
to 127.0.0.1 or 0.0.0.0, or comment out that line.
还是行不通?尝试将绑定地址更改my.cnf
为 127.0.0.1 或 0.0.0.0,或注释掉该行。
If you're still out of luck, search for more information about mysql_install_db
and since your InnoDB database may be broken also look into set-variable=innodb_force_recovery=6
.
如果您仍然不走运,请搜索有关mysql_install_db
InnoDB 数据库可能已损坏的更多信息,请查看set-variable=innodb_force_recovery=6
.
回答by h4unt3r
Hey sometimes it's because you ran out of disk space... so run a cursory df -h
to be sure! (This JUST happened to me :P).
嘿,有时是因为您的磁盘空间不足……所以请粗略df -h
地运行以确保!(这只是发生在我身上:P)。
回答by farhan
Before starting the mysql server rename files /var/lib/mysql/ib_logfile0
and /var/lib/mysql/ib_logfile0
then restart the server
启动MySQL服务器的重命名文件之前/var/lib/mysql/ib_logfile0
和 /var/lib/mysql/ib_logfile0
然后重新启动服务器
in linux/unix
在 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
then
然后
service mysqld restart
回答by 16851556
In my case the cause was that i set key_buffer_size in /etc/my.cnf when i commented it out, mysqld started ok.
就我而言,原因是当我将其注释掉时,我在 /etc/my.cnf 中设置了 key_buffer_size,mysqld 启动正常。
回答by Ammad
Try This:
尝试这个:
rm $(grep socket /etc/my.cnf | cut -d= -f2) && service mysqld start