1. 程式人生 > >Can't start server: can't create PID file: No space left on device

Can't start server: can't create PID file: No space left on device

這篇文章主要介紹了mysql啟動失敗不能正常啟動並報錯Can't start server: can't create PID file: No space left on device問題解決方法,需要的朋友可以參考下

解決案例一:

今天公司伺服器上所有的網站都出現問題,有的開啟沒有資料,有的直接是空白。

我的第一反應就是資料庫掛了。開啟遠端,進了系統,service mysqld stop 失敗。service mysqld start等了好大一會,提示Timeout error occurred trying to start MySQL Daemon

一開始以為是mysql使用者問題,查詢系統使用者完全沒有問題。

開啟log日誌一看,問題出現了Can't start server: can't create PID file: No space left on device;

df -h看了一下磁碟,500G的硬碟已經使用了100%,可用為0;

一咬牙刪光了var/log資料夾。沒想到的是log日誌已經積累達到32G。

狂汗!!!而後啟動mysql一切正常了。

解決案例二:

最近在維護linux伺服器時發現,網站打不開了,經過檢查發現是mysql資料庫宕掉了,死活就是啟動不起來。

然後看mysql日誌檔案

出現Can't start server: can't create PID file: No space left on device

這個錯誤。

提示磁碟空間不足

後用df -h 命令檢視

竟然發現磁碟容量全部用完了,於是要檢視是誰佔用了
用命令:
find /tmp -size +100000000c
查詢下磁碟中大於100M的檔案
竟然出現:

tomcat的日誌檔案佔用了443G,真是可惡啊啊
 
 刪掉此日誌檔案
rm -rf catalina.out
重新啟動mysql即可。
最好重啟linux os。

解決案例三:

mysql啟動失敗,日誌顯示如下: 

複製程式碼程式碼如下:
120321 14:23:54 InnoDB: 1.1.8 started; log sequence number 1595695
120321 14:23:54 [ERROR] /usr/libexec/mysqld: Error writing file ‘/var/run/mysqld/mysqld.pid' (Errcode: 28)
120321 14:23:54 [ERROR] Can't start server: can't create PID file: No space left on device
120321 14:23:54 mysqld_safe Number of processes running now: 0
120321 14:23:54 mysqld_safe mysqld restarted
120321 14:23:54 [Note] Plugin ‘FEDERATED' is disabled.
120321 14:23:54 InnoDB: The InnoDB memory heap is disabled
120321 14:23:54 InnoDB: Mutexes and rw_locks use InnoDB's own implementation
120321 14:23:54 InnoDB: Compressed tables use zlib 1.2.3
120321 14:23:54 InnoDB: Using Linux native AIO
120321 14:23:54 InnoDB: Initializing buffer pool, size = 128.0M
120321 14:23:54 InnoDB: Completed initialization of buffer pool
120321 14:23:54 InnoDB: highest supported file format is Barracuda.
120321 14:23:55  InnoDB: Waiting for the background threads to start

 
其實答案很簡單,
No space left on device 沒有磁碟空間了。      清理/var/log的空間!