萬盛學電腦網

 萬盛學電腦網 >> 數據庫 >> mysql教程 >> mysql刪除mysql

mysql刪除mysql

今天在做一台服務器的轉站處理,發現裡面有大量的mysql-bin.000xxx這種文件了,因為服務器暫時沒用就把mysql停止了,然後我把所有的mysql-bin.000xxx文件全部刪除,結果發現mysql無法啟動了,下面小編就來給各位介紹問題解決辦法。

在啟動mysql時提示mysql啟動了,查看系統事件日志如下

Could not open log file

看不懂那個日志文件不能打開,於時到mysql的data目錄下的一個xxxx-b59093774c.err錯誤文件,打開如下一如下一段代碼

141019 22:35:49 [Note] Plugin 'FEDERATED' is disabled.
141019 22:35:49 InnoDB: The InnoDB memory heap is disabled
141019 22:35:49 InnoDB: Mutexes and rw_locks use Windows interlocked functions
141019 22:35:49 InnoDB: Compressed tables use zlib 1.2.3
141019 22:35:49 InnoDB: Initializing buffer pool, size = 128.0M
141019 22:35:49 InnoDB: Completed initialization of buffer pool
141019 22:35:49 InnoDB: highest supported file format is Barracuda.
141019 22:35:50  InnoDB: Waiting for the background threads to start
141019 22:35:51 InnoDB: 1.1.8 started; log sequence number 22869842
x:/vsr/mpyx/bin/mysqld: File './mysql-bin.000574' not found (Errcode: 2)
141019 22:35:51 [ERROR] Failed to open log (file './mysql-bin.000574', errno 2)
141019 22:35:51 [ERROR] Could not open log file
141019 22:35:51 [ERROR] Can't init tc log
141019 22:35:51 [ERROR] Aborting

141019 22:35:51  InnoDB: Starting shutdown...
141019 22:35:51  InnoDB: Shutdown completed; log sequence number 22869842
141019 22:35:51 [Note] x:/vsr/mpyx/bin/mysqld: Shutdown complete

注意我個看發其中有一個

x:/vsr/mpyx/bin/mysqld: File './mysql-bin.000574' not found (Errcode: 2)
141019 22:35:51 [ERROR] Failed to open log (file './mysql-bin.000574', errno 2)

代碼,意思是批/mysql-bin.000574文件不存在了,現在解決好了,我剛刪除的文件在恢復站直接恢復/mysql-bin.000574文件再啟動發現mysql啟動正常了哦


總結,mysql如果有大量的二進制日志文件我們刪除時一定要注意,保留id為最大的那一個不要刪除或直接在my.inik 中關閉mysql二進制日志生成即可解決此問題。

copyright © 萬盛學電腦網 all rights reserved