今天在做一台服务器的转站处理,发现里面有大量的mysql-bin.000xxx这种文件了,因为服务器暂时没用就把mysql停止了,然后我把所有的mysql-bin.000xxx文件全部删除,结果发现mysql无法启动了,下面小编就来给各位介绍问题解决办法.
在启动mysql时提示mysql启动了,查看系统事件日志如下:
Could not open log file
看不懂那个日志文件不能打开,于时到mysql的data目录下的一个xxxx-b59093774c.err错误文件,打开如下一如下一段代码:
- 14101922:35:49[Note]Plugin'FEDERATED'isdisabled.
- 14101922:35:49InnoDB:TheInnoDBmemoryheapisdisabled
- 14101922:35:49InnoDB:Mutexesandrw_locksuseWindowsinterlockedfunctions
- 14101922:35:49InnoDB:Compressedtablesusezlib1.2.3
- 14101922:35:49InnoDB:Initializingbufferpool,size=128.0M
- 14101922:35:49InnoDB:Completedinitializationofbufferpool
- 14101922:35:49InnoDB:highestsupportedfileformatisBarracuda.
- 14101922:35:50InnoDB:Waitingforthebackgroundthreadstostart
- 14101922:35:51InnoDB:1.1.8started;logsequencenumber22869842
- x:/vsr/mpyx/bin/mysqld:File'./mysql-bin.000574'notfound(Errcode:2)
- 14101922:35:51[ERROR]Failedtoopenlog(file'./mysql-bin.000574',errno2)
- 14101922:35:51[ERROR]Couldnotopenlogfile
- 14101922:35:51[ERROR]Can'tinittclog
- 14101922:35:51[ERROR]Aborting
- //phpfensi.com
- 14101922:35:51InnoDB:Startingshutdown...
- 14101922:35:51InnoDB:Shutdowncompleted;logsequencenumber22869842
- 14101922:35:51[Note]x:/vsr/mpyx/bin/mysqld:Shutdowncomplete
注意我个看发其中有一个:
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二进制日志生成即可解决此问题.