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

时间:2022-08-28 07:55:38

解决案例一:

今天公司服务器上所有的网站都出现问题,有的打开没有数据,有的直接是空白。

我的第一反应就是数据库挂了。打开远程,进了系统,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日志文件

mysql: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

这个错误。

提示磁盘空间不足

后用df -h 命令查看

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

竟然发现磁盘容量全部用完了,于是要查看是谁占用了
用命令:
find /tmp -size +100000000c
查找下磁盘中大于100M的文件
竟然出现:

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

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的空间!