我的mysqld.log文件很大,大约1.2GB,到目前为止保存了2014年的数据。如何删除旧记录,只留下记录,例如从这个月开始?问题是,我的数据库连续两天崩溃,恢复后不会再次启动。以下是日志文件的摘录:
170514 16:23:25 mysqld_safe Number of processes running now: 0
170514 16:23:25 mysqld_safe mysqld restarted
170514 16:23:25 InnoDB: Initializing buffer pool, size = 512.0M
170514 16:23:25 InnoDB: Completed initialization of buffer pool
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
170514 16:23:25 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
170514 16:23:25 InnoDB: Started; log sequence number 0 88464080
170514 16:23:25 [Note] Event Scheduler: Loaded 0 events
170514 16:23:25 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.73' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution发布于 2017-05-15 12:04:53
您必须访问mysql并检查二进制日志,以便使用命令ls -la /var/lib/mysql/来决定要删除的位置。
您可能会得到这样的日志:rw-rw- mysql 104871967 8 00:01 BINLOG.015687 -rw-rw-1 mysql 104885618 8月24日00:04 BINLOG.015688 -rw- mysql mysql 104866713 8月24日:06 BINLOG.015689
然后删除日期前的日志:在“2013-08-24 00:06:00”之前清除二进制日志;
https://stackoverflow.com/questions/43978881
复制相似问题