2012-01-11 42 views
20

我在CentOS上遇到了MySQL的麻煩。 我有一些問題,並備份我的數據庫,並刪除與所有依賴關係的MySQL。 之後,我跑了重新安裝:嘗試啓動MySQL守護程序時發生超時錯誤。 CentOS 5

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 

日誌文件是空的。我甚至不知道如何進行調試,也不知道該怎麼做。

有什麼建議嗎?

謝謝

回答

23

嘿有時候,這是因爲磁盤空間不足......所以請運行一個粗略的df -h以確保! (這件事發生在我身上:P)。

+1

這爲我節省了很多時間,謝謝! – 2015-05-07 20:50:08

+0

按小時4會想到那個!謝謝! – 2015-07-01 19:49:31

35

我知道你問這個是很久以前,但由於誰搜索人「超時出錯嘗試啓動MySQL守護進程。」可能會在這裏結束,但有幾種可能的解決方案來解決這個錯誤。下面是其中一些:

第一,而不是運行service mysqld startservice mysqld restart試運行:

mysqladmin線在 /etc/init.d/mysqld腳本

$ service mysqld stop; mysqld_safe &

有一些已知的問題。

如果不工作,請嘗試以下操作:檢查是否有足夠的可用磁盤空間(尤其是/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

7

之前啓動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 
+0

雖然下面的答案有更多的選擇,但這是我工作的那個。謝謝! – 2013-12-31 20:08:56

0

在我的情況的原因是,我設置key_buffer_size在/etc/my.cnf當我評論出來時,mysqld開始正常。

0

試試這個:

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