mysql更新日志问题

[root@localhost ~]# /etc/init.d/mysqld restart
停止 mysqld:                                              [确定]
正在启动 mysqld:                                          [确定]

 

故障:今天在维护以前数据库日志的时候,把目录下所有的日志都压缩拷贝到本地了以防以后查询使用,压缩之后清理了日志目录下/var/log/mysqllog所有的日志,然后重启服务

/etc/init.d/mysqld restart

[root@localhost ~]# /etc/init.d/mysqld start
MySQL Daemon failed to start.
正在启动 mysqld:                                          [失败]

查看日志,

mysql更新日志问题
[root@localhost ~]# tailf /var/log/mysqld.log 
140226 10:58:40 [ERROR] Failed to open log (file /var/log/mysqllog/myupdate.000050, errno 2)
140226 10:58:40 [ERROR] Could not open log file
140226 10:58:40 [ERROR] Cant init tc log
140226 10:58:40 [ERROR] Aborting

140226 10:58:40  InnoDB: Starting shutdown...
140226 10:58:45  InnoDB: Shutdown completed; log sequence number 0 168021
140226 10:58:45 [Note] /usr/libexec/mysqld: Shutdown complete

140226 10:58:45 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
mysql更新日志问题

 

 这个文件已经被我删除/var/log/mysqllog/myupdate.000050,是更新日志最后一个文件,所以mysql找不到这个文件,应该是还准备往这个文件里面写日志,所以我想是不是有什么命令应该可以让mysql更新日志重新滚动呢,在网上找了好久没找到,最后看见了在目录下面myupdate.index 这个文件。

[root@localhost mysqllog]# ls
log.sh  mycommon-20140221.log  mycommon-20140222.log  mycommon-20140223.log  mycommon-20140224.log  mycommon-20140225.log  mycommon.log  myupdate.index
mysql更新日志问题
[root@localhost mysqllog]# more myupdate.index 
/var/log/mysqllog/myupdate.000001
/var/log/mysqllog/myupdate.000002
/var/log/mysqllog/myupdate.000003
/var/log/mysqllog/myupdate.000004
/var/log/mysqllog/myupdate.000005
/var/log/mysqllog/myupdate.000006
/var/log/mysqllog/myupdate.000007
/var/log/mysqllog/myupdate.000008
/var/log/mysqllog/myupdate.000009
/var/log/mysqllog/myupdate.000010
/var/log/mysqllog/myupdate.000011
/var/log/mysqllog/myupdate.000012
/var/log/mysqllog/myupdate.000013
/var/log/mysqllog/myupdate.000014
/var/log/mysqllog/myupdate.000015
/var/log/mysqllog/myupdate.000016
/var/log/mysqllog/myupdate.000017
/var/log/mysqllog/myupdate.000018
/var/log/mysqllog/myupdate.000019
/var/log/mysqllog/myupdate.000020
/var/log/mysqllog/myupdate.000021
/var/log/mysqllog/myupdate.000022
/var/log/mysqllog/myupdate.000023
/var/log/mysqllog/myupdate.000024
/var/log/mysqllog/myupdate.000025
/var/log/mysqllog/myupdate.000026
/var/log/mysqllog/myupdate.000027
/var/log/mysqllog/myupdate.000028
/var/log/mysqllog/myupdate.000029
/var/log/mysqllog/myupdate.000030
/var/log/mysqllog/myupdate.000031
/var/log/mysqllog/myupdate.000032
/var/log/mysqllog/myupdate.000033
/var/log/mysqllog/myupdate.000034
/var/log/mysqllog/myupdate.000035
/var/log/mysqllog/myupdate.000036
/var/log/mysqllog/myupdate.000037
/var/log/mysqllog/myupdate.000038
/var/log/mysqllog/myupdate.000039
/var/log/mysqllog/myupdate.000040
/var/log/mysqllog/myupdate.000041
/var/log/mysqllog/myupdate.000042
/var/log/mysqllog/myupdate.000043
/var/log/mysqllog/myupdate.000044
/var/log/mysqllog/myupdate.000045
/var/log/mysqllog/myupdate.000046
/var/log/mysqllog/myupdate.000047
/var/log/mysqllog/myupdate.000048
/var/log/mysqllog/myupdate.000049
/var/log/mysqllog/myupdate.000050
mysql更新日志问题

原来这是记录了所有文件的索引信息,是不是清空了就会重新创建000001文件呢,试了一下。

[root@localhost mysqllog]# >myupdate.index 

 

[root@localhost ~]# /etc/init.d/mysqld restart
停止 mysqld:                                              [确定]
正在启动 mysqld:                                          [确定]

果然可以正常启动了,再看目录下面也确实创建了000001,不知道有没有像我一样遇到这样问题的朋友,我觉得应该会有什么命令可以重载myupdate.index文件,本人数据库新手,虽然这个故障可能对于别人比较简单,记录下来供刚入门的朋友参考。

mysql更新日志问题,布布扣,bubuko.com

mysql更新日志问题

上一篇:C#操作SQL时使用事务介绍


下一篇:C# UDP to数据