1. 程式人生 > >mysql啟動時報 Bind on unix socket Address already in use的問題處理

mysql啟動時報 Bind on unix socket Address already in use的問題處理

一.問題描述:
 版本:mariadb 10.0.2
啟動mysql:
/apps/svr/mariadb10/bin/mysqld_safe --defaults-file=/apps/dbdat/mariadb10_data3306/my3306.cnf  --socket=/tmp/mysql3306.sock &
無法啟動,mysql程序退出。

二.問題分析:
檢查error log,如下:
160826 15:33:33 [Note] Server socket created on IP: '0.0.0.0'.
160826 15:33:33 [ERROR] Can't start server : Bind on unix socket: Address already in use
160826 15:33:33 [ERROR] Do you already have another mysqld server running on socket: /tmp/mysql3306.sock ?
160826 15:33:33 [ERROR] Aborting

160826 15:33:33 [Note] InnoDB: FTS optimize thread exiting.
160826 15:33:33 [Note] InnoDB: Starting shutdown...
160826 15:33:36 [Note] InnoDB: Shutdown completed; log sequence number 452295626292
160826 15:33:36 [Note] /apps/svr/mariadb10/bin/mysqld: Shutdown complete

160826 15:33:36 mysqld_safe mysqld from pid file /apps/dbdat/mariadb10_data3306/mysql.pid ended

上面提示unix socket /tmp/mysql3306.sock 被佔用,用ps -ef|grep mysql檢查沒有其它mysql程序.用netstat -an|grep 3306檢查埠也不存在。
對比分析,正常關閉mysql時,/tmp/mysql3306.sock檔案是不存在的,而現在mysql已關閉後,還存在/tmp/mysql3306.sock檔案。
猜測是由於上次mysql未正常關閉或關閉異常引起。
 

三.問題解決
  在root使用者下,刪除/tmp/mysql3306.sock檔案,再重啟mysql。