主頁(yè) > 知識(shí)庫(kù) > 解決MySQL因不能創(chuàng)建 PID 導(dǎo)致無(wú)法啟動(dòng)的方法

解決MySQL因不能創(chuàng)建 PID 導(dǎo)致無(wú)法啟動(dòng)的方法

熱門(mén)標(biāo)簽:寧波企業(yè)外呼系統(tǒng)收費(fèi) 沈陽(yáng)電銷(xiāo)外呼系統(tǒng)原理是什么 成都優(yōu)派外呼系統(tǒng) 聊城智能外呼系統(tǒng)運(yùn)營(yíng)商 ps制作地圖標(biāo)注gif 電子地圖標(biāo)注電話 上海智能外呼系統(tǒng)代理商 扎樣申請(qǐng)400電話 地圖標(biāo)注人員兼職

問(wèn)題描述

MySQL 啟動(dòng)報(bào)錯(cuò)信息如下:

Starting mysqld (via systemctl):
 Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details、 [FAILED]

根據(jù)提示,使用 systemctl status mysqld.service journalctl -xe 查看服務(wù)啟動(dòng)失敗的原因。

[root@ ~]# systemctl status mysqld.servicemysqld.service - SYSV: MySQL database server.Loaded: loaded (/etc/rc.d/init.d/mysqld)Active: failed (Result: exit-code) since Wed 2016-01-20 18:26:57 CST; 40s agoDocs: man:systemd-sysv-generator(8)Process: 2979 ExecStart=/etc/rc.d/init.d/mysqld start (code=exited, status=1/FAILURE)Jan 20 18:26:56 spark01 systemd[1]: Starting SYSV: MySQL database server….Jan 20 18:26:57 spark01 mysqld[2979]: MySQL Daemon failed to start.Jan 20 18:26:57 spark01 mysqld[2979]: Starting mysqld: [FAILED]Jan 20 18:26:57 spark01 systemd[1]: mysqld.service: control process exited, code=exited status=1Jan 20 18:26:57 spark01 systemd[1]: Failed to start SYSV: MySQL database server..Jan 20 18:26:57 spark01 systemd[1]: Unit mysqld.service entered failed state.Jan 20 18:26:57 spark01 systemd[1]: mysqld.service failed.[root@ ~]# journalctl -xeUnit session-2.scope has begun starting up.Jan 20 18:26:48 spark01 sshd[2916]: pam_unix(sshd:session): session opened for user spark by (uid=0)Jan 20 18:26:52 spark01 su[2944]: (to root) spark on pts/1Jan 20 18:26:52 spark01 su[2944]: pam_unix(su-l:session): session opened for user root by spark(uid=1000)Jan 20 18:26:56 spark01 polkitd[909]: Registered Authentication Agent for unix-process:2974:117137 (system bus name :1.25Jan 20 18:26:56 spark01 systemd[1]: Starting SYSV: MySQL database server….— Subject: Unit mysqld.service has begun start-up— Defined-By: systemd— Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel—— Unit mysqld.service has begun starting up.Jan 20 18:26:57 spark01 mysqld[2979]: MySQL Daemon failed to start.Jan 20 18:26:57 spark01 mysqld[2979]: Starting mysqld: [FAILED]Jan 20 18:26:57 spark01 systemd[1]: mysqld.service: control process exited, code=exited status=1Jan 20 18:26:57 spark01 systemd[1]: Failed to start SYSV: MySQL database server..— Subject: Unit mysqld.service has failed— Defined-By: systemd— Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel—— Unit mysqld.service has failed.—— The result is failed.Jan 20 18:26:57 spark01 systemd[1]: Unit mysqld.service entered failed state.Jan 20 18:26:57 spark01 systemd[1]: mysqld.service failed.Jan 20 18:26:57 spark01 polkitd[909]: Unregistered Authentication Agent for unix-process:2974:117137 (system bus name :1.

這些信息并不能提供服務(wù)啟動(dòng)失敗的真正原因。

查看 MySQL 的告警日志:

2016-01-20T10:00:19.935771Z 0 [ERROR] /usr/sbin/mysqld: Can't create/write to file ‘/var/run/mysqld/mysqld.pid' (Errcode: 2 - No such file or directory)2016-01-20T10:00:19.935795Z 0 [ERROR] Can't start server: can't create PID file: No such file or directory160120 18:00:20 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

解決辦法

MySQL 服務(wù)在啟動(dòng)的時(shí)候,不能創(chuàng)建 pid 文件。

在終端看一下該目錄是否存在,如果不存在,手動(dòng)創(chuàng)建:

[root@ ~]# mkdir -p /var/run/mysqld/

再次嘗試啟動(dòng) MySQL 服務(wù),報(bào)錯(cuò)如下:

Starting mysqld (via systemctl):
 Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details. [FAILED]

查看 MySQL 的告警日志:

2016-01-20T10:28:37.183387Z 0 [ERROR] /usr/sbin/mysqld: Can't create/write to file ‘/var/run/mysqld/mysqld.pid' (Errcode: 13 - Permission denied)2016-01-20T10:28:37.183431Z 0 [ERROR] Can't start server: can't create PID file: Permission denied160120 18:28:37 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended160120 18:32:06 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

權(quán)限不正確,/var/run/mysqld/ 的屬主和屬組還是 root,MySQL 并不能在其中創(chuàng)建文件后修改該目錄的屬主和屬組

[root@ ~]# ls -ld /var/run/mysqld/drwxr-xr-x 2 root root 40 Jan 20 18:28 /var/run/mysqld/
[root@ ~]# chown mysql.mysql /var/run/mysqld/
[root@ ~]# /etc/init.d/mysqld startStarting mysqld (via systemctl):       [ OK ]

總結(jié)

以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作能帶來(lái)一定的幫助,如果有疑問(wèn)大家可以留言交流,謝謝大家對(duì)腳本之家的支持。

您可能感興趣的文章:
  • Python聊天室?guī)Ы缑鎸?shí)現(xiàn)的示例代碼(tkinter,Mysql,Treading,socket)
  • ERROR 2002 (HY000): Can''t connect to local MySQL server through socket ''/tmp/mysql.sock''
  • Can''t connect to local MySQL through socket ''/tmp/mysql.sock''解決方法
  • java+jdbc+mysql+socket搭建局域網(wǎng)聊天室
  • Java Socket+mysql實(shí)現(xiàn)簡(jiǎn)易文件上傳器的代碼
  • mysql socket文件作用詳解
  • MySQL錯(cuò)誤ERROR 2002 (HY000): Can''t connect to local MySQL server through socket
  • MySQL HandlerSocket插件安裝配置教程
  • 深度解析MySQL啟動(dòng)時(shí)報(bào)“The server quit without updating PID file”錯(cuò)誤的原因
  • mysql啟動(dòng)報(bào)錯(cuò)MySQL server PID file could not be found
  • Mysql掛掉后無(wú)法重啟報(bào)pid文件丟失的解決方法
  • MySQL下PID文件丟失的相關(guān)錯(cuò)誤的解決方法
  • mysql:Can''t start server: can''t create PID file: No space left on device
  • MySQL提示:The server quit without updating PID file問(wèn)題的解決辦法
  • linux mysql 報(bào)錯(cuò):MYSQL:The server quit without updating PID file
  • Starting MySQL.Manager of pid-file quit without updating file.[FAILED]的解決方法
  • 詳解MySQL中的pid與socket

標(biāo)簽:汕頭 三明 朔州 宿州 林芝 咸寧 AXB 內(nèi)江

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《解決MySQL因不能創(chuàng)建 PID 導(dǎo)致無(wú)法啟動(dòng)的方法》,本文關(guān)鍵詞  解決,MySQL,因,不能,創(chuàng)建,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《解決MySQL因不能創(chuàng)建 PID 導(dǎo)致無(wú)法啟動(dòng)的方法》相關(guān)的同類信息!
  • 本頁(yè)收集關(guān)于解決MySQL因不能創(chuàng)建 PID 導(dǎo)致無(wú)法啟動(dòng)的方法的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章