筆記:記一次MySQL報錯及解決過程

MySQL 報錯及解決方案

在使用 MySQL 過程中,遇到了以下報錯:

2024-09-02T14:54:39.825067Z 0 [ERROR] InnoDB: Write to file ./ibtmp1 failed at offset 0, 1048576 bytes should have been
written, only 0 were written. Operating system error number 28. Check that your OS and file system support files of this
size. Check also that the disk is not full or a disk quota exceeded.
2024-09-02T14:54:39.825085Z 0 [ERROR] InnoDB: Error number 28 means 'No space left on device'
2024-09-02T14:54:39.825089Z 0 [Note] InnoDB: Some operating system error numbers are described at http://dev.mysql.com
/doc/refman/5.7/en/operating-system-error-codes.html
2024-09-02T14:54:39.825093Z 0 [ERROR] InnoDB: Could not set the file size of './ibtmp1'. Probably out of disk space
2024-09-02T14:54:39.825096Z 0 [ERROR] InnoDB: Unable to create the shared innodb_temporary
2024-09-02T14:54:39.825103Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2024-09-02T14:54:40.227301Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2024-09-02T14:54:40.227319Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2024-09-02T14:54:40.227325Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2024-09-02T14:54:40.227331Z 0 [ERROR] Failed to initialize builtin plugins.
2024-09-02T14:54:40.227334Z 0 [ERROR] Aborting

問題原因

報錯信息顯示 No space left on device,即磁盤空間不足。

解決步驟

1. 檢查磁盤占用情況

使用 du -sh * 命令查看磁盤占用情況:

du -sh *

2. 定位占用大量空間的文件

發(fā)現(xiàn) /var/lib/docker/overlay2/b10a9fb4ba3d950874b4bdecaa278fb8fb3524b14b532c78cd75f6c 文件占用了 49GB

3. 檢查 Docker 容器

查看 Docker 容器,發(fā)現(xiàn)該容器是用于 TTS(文本轉(zhuǎn)語音)任務(wù),其中的日志文件占用了大量空間

4. 刪除日志文件

使用rm -f ,刪除容器中的日志文件

5. 重啟服務(wù)器和 MySQL 服務(wù)

重啟服務(wù)器

shutdown -r

總結(jié)

通過上述步驟,成功解決了磁盤空間不足的問題,并恢復了 MySQL 的正常運行。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容