Unable to start MySQL service. Another MySQL daemon is already running with the same UNIX socket,unablemysql

來源:互聯網
上載者:User

Unable to start MySQL service. Another MySQL daemon is already running with the same UNIX socket,unablemysql
Unable to start MySQL service. Another MySQL daemon is already running with the same UNIX socket

 

特徵

如果你遇到如下所列的任何問題之一,本文也許能幫到你.

  • MySQL starts/stops properly when started/stopped with the mysqld service restart, but MySQL does not start when a server is rebooted.
  • After upgrading MySQL, binaries mysqld will not start at all.
  • After relocating the MySQL datadir or changing the default port, MySQL does not start.

以上所有問題有一個共同特徵:你無法使用service mysqld restart/start或其他方式啟動mysql.

1234 [root@server ~]# /etc/init.d/mysqld startAnother MySQL daemon already running with the same unix socket.Starting mysqld:                                           [FAILED] 

原因

非正常的關閉/停止服務,導致mysqld的socket沒有被移除. 該非正常的方式比較常見於:系統斷電重啟.

解決辦法

There are several common cases when the socket file is not removed. Please check the below use cases and apply the appropriate resolution.

1. 查看/var/log/mysqld.log,你會發現類似如下日誌:

123456789 13120721:15:47mysqld_safeStartingmysqlddaemonwithdatabasesfrom/var/lib/mysql/usr/libexec/mysqld:Can't create/write to file '/tmp/ib0h0Wt3' (Errcode: 13)131207 21:15:47  InnoDB: Error: unable to create temporary file; errno: 13131207 21:15:47 [ERROR] Plugin 'InnoDB' init function returned error.131207 21:15:47 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.131207 21:15:47 [Note] Event Scheduler: Loaded 0 events131207 21:15:47 [Note] /usr/libexec/mysqld: ready for connections.Version: '5.1.71'  socket: '/var/lib/mysql/mysql.sock'  port:3306  Sourcedistribution 

網上百度到該問題的解決辦法都是:

1 rm /var/lib/mysql/mysql.sock

1 <spanstyle="font-family: monospace;">mv/var/lib/mysql/mysql.sock/var/lib/mysql/mysql.sock.bak</span>

筆者試了很多此,發現還是啟動不成功.細看log,文本末尾寫著的不只/var/lib/mysql/mysql.sock,還有/var/lib/mysql/mysql1.sock,/var/lib/mysql/mysql22.sock.而我的檔案夾目錄中也正好存在這些檔案.於是猜想, mysql異常關閉之後,不單只產生myql.sock,還有其他sock檔案,我將這三個sock檔案都重新命名後,myql便正常啟動了.

1 rm /var/lib/mysql/mysql.sock

1 rm/var/lib/mysql/mysql1.sock

1 rm/var/lib/mysql/mysql22.sock

2. 總結

 mysql異常關閉時,產生的sock檔案可能存在多個,要將這些sock檔案都清除,mysql才能正常啟動.

 

原文連結:Unable to start MySQL service. Another MySQL daemon is already running with the same UNIX socket.

參考文獻:http://kb.sp.parallels.com/en/119334

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.