2012-07-28 70 views
0

我是新來的論壇,但我希望能夠變得更加活躍,因爲我最近購買了一臺專用服務器,並且正在運行Fedora,所以這是一個不斷學習的過程,在BASH中相當平均,但我足夠了解我的方式,我是一個軟件開發人員,不僅僅是交易網絡techi。這導致我最初的問題,我重新啓動我的dedi後開始我的MySQL守護進程的問題,我不知道爲什麼突然這樣做,我從服務器運行PHPMyAdmin,還通過CLI發出某些命令MySQL,但是在重新啓動我得到這個錯誤後,每次我嘗試啓動守護進程的實例:啓動MySQL Daemon時出現問題

[[email protected] ~]# service mysqld start 
Redirecting to /bin/systemctl start mysqld.service 
[[email protected] ~]# systemctl mysqld start 
Unknown operation mysqld 
[[email protected] ~]# systemctl start mysqld 
Failed to issue method call: Unit name mysqld is not valid. 
[[email protected] ~]# systemctl start mysqld.service 
[[email protected] ~]# mysql 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/path/to/mysql.sock' (2) 

它完全是怪異,因爲它是完美的工作之前,我重新啓動它,我沒有更新或更改安裝,我做的唯一的事情是安裝postfix,但我不明白爲什麼這會導致與MySQL的任何問題:S

我真的需要在這一個手,我已經嘗試了幾個解決方案谷歌沒有無論結果如何。先謝謝你們。

~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

更新1:

好了,所以我找到了目錄mysqld正在舉行,這是 '在/ usr/libexec目錄/ mysqld的',我輸入這個目錄中 './mysqld開始',並指定該輸出:

120729 1:49:09 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead. 
120729 1:49:09 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead. 
120729 1:49:09 [Warning] Can't create test file /run/mysql/ks23085.lower-test 
120729 1:49:09 [Warning] Can't create test file /run/mysql/ks23085.lower-test 
./mysqld: Can't change dir to '/run/mysql/' (Errcode: 2) 
120729 1:49:09 [ERROR] Aborting 

120729 1:49:09 [Note] ./mysqld: Shutdown complete 

~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~ 更新2:

我設法通過在所有我的舊數據庫的'run /'中創建'mysql'目錄來傳遞目錄問題,但是現在我似乎得到了一個似乎並不容易解決的錯誤:/

下面是輸出:

120729 2:15:59 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead. 
120729 2:15:59 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future release. Please use '--slow-query-log'/'--slow-query-log-file' instead. 
120729 2:15:59 [Warning] Can't create test file /run/mysql/ks23085.lower-test 
120729 2:15:59 [Warning] Can't create test file /run/mysql/ks23085.lower-test 
120729 2:15:59 [Note] Plugin 'FEDERATED' is disabled. 
120729 2:15:59 [Note] Plugin 'InnoDB' is disabled. 
mysqld: Can't find file: './mysql/plugin.frm' (errno: 13) 
120729 2:15:59 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 
120729 2:15:59 [ERROR] mysqld: unknown option '--skip-locking' 
120729 2:15:59 [ERROR] Aborting 

120729 2:15:59 [Note] mysqld: Shutdown complete 
+1

Mysqld可能無法啓動。進入mysql安裝文件夾並從那裏運行mysqld守護進程(不作爲服務),因此它會打印日誌,並將其粘貼到此處。 – Jimmy 2012-07-28 17:11:11

+0

fedora上的mysql安裝文件夾在哪裏?因爲我似乎無法在/ etc/mysql /任何想法中找到mydql守護進程? – 2012-07-28 18:11:34

+0

執行rpm -ql mysqld。這會給你包myslqd的列表。如果你的軟件包被稱爲myslq-server- <版本號>或其他 - 請使用該名稱。只有當你通過軟件包管理器安裝了軟件包時, – hovanessyan 2012-07-28 18:18:57

回答

1

official doc指出有此錯誤2個可能的原因:

  1. You don't have permissions to access the directory /var/lib/mysql/whatever.sock because mysql is the owner of the folder or
  2. /path/whatever.sock doesn't exist.

執行下面找到你的插座:

mysqladmin variables | grep socket 

添加到配置文件的建議:

You can try this though [Linux specific, but what other operating systems are there?] Go to /etc/my.cnf and change/add the lines:

[mysqld]

datadir=/var/lib/mysql

socket=/tmp/mysql.sock

[client]

socket=/tmp/mysql.sock

2)不要忘記檢查你的權限!

+0

我以root身份登錄,所以我絕對擁有權限,我已經配置了my.cnf,它似乎忽略了我更新它的事實。 這是當我執行''時得到的結果: '代碼 mysqladmin:在'localhost'連接服務器失敗 錯誤:'無法通過套接字連接到本地MySQL服務器'/path/to/mysql.sock '(111)' 檢查mysqld是否正在運行,並且套接字'/path/to/mysql.sock'存在! ' – 2012-07-28 18:21:56

+0

您需要重新加載或重新啓動服務才能啓動新配置。 – hovanessyan 2012-07-28 18:23:03

+0

如何執行此操作?因爲沒有運行mysqld的實例:S – 2012-07-28 18:24:42