mysql>SHOW MASTER LOGS;
此命令显示目前二进制日志的数目。
然后
mysql> PURGE MASTER LOGS TO ‘binary-log.xxx’;
mysql > flush logs;
mysql > reset master;
除了命令中给出的日志之后的外,其他的二进制日志全部删除。
具体如下:
PURGE MASTER LOGS
PURGE { MASTER|BINARY } LOGS TO ‘log_name’
PURGE { MASTER|BINARY } LOGS BEFORE ‘date’
Deletes all the binary logs listed in the log index that are strictly
prior to the specified log or date. The logs also are removed from this
list recorded in the log index file, so that the given log now becomes
the first.
Example:
PURGE MASTER LOGS TO ‘mysql-bin.010′;
PURGE MASTER LOGS BEFORE ’2003-04-02 22:46:26′;
The BEFORE variant is available in MySQL 4.1; its date argument can
be in ‘YYYY-MM-DD hh:mm:ss’ format. MASTER and BINARY are synonyms,
though BINARY can be used only as of MySQL 4.1.1.
If you have an active slave that is currently reading one of the logs
you are trying to delete, this command does nothing and fails with an
error. However, if you have a dormant slave, and happen to purge one of
the logs it wants to read, the slave will be unable to replicate once it
comes up. The command is safe to run while slaves are replicating. You
do not need to stop them.
You must first check all the slaves with SHOW SLAVE STATUS to see
which log they are reading, then do a listing of the logs on the master
with SHOW MASTER LOGS, find the earliest log among all the slaves (if
all the slaves are up to date, this will be the last log on the list),
backup all the logs you are about to delete (optional) and purge up to
the target log.
分享到:
相关推荐
mysql日志清理手册
SQL server 2000 数据库log文件的清除,只须打开文件,选种到对应的数据库名,点击清理即可.
MySQL bin-log 日志清理方式 MySQL bin-log 日志清理方式
mysql 正确清理binlog日志的两种方法
mysql的LOG日志占用空间如果比较大的话,需要进行清理,整理了日志清理的四种方法,方便大家安全清理日志
主要介绍了MySQL 自动清理binlog日志的方法,需要的朋友可以参考下
windows下mysql自动备份数据库并删除历史备份和生成日志文件脚本。windows下mysql自动备份数据库并删除历史备份和生成日志文件脚本。
主要给大家介绍了Mysql数据库清理binlog日志命令的相关资料,文中通过示例代码介绍的非常详细,对大家学习或者使用Mysql具有一定的参考学习价值,需要的朋友们下面来一起学习学习吧
主要介绍了MYSQL日志的正确删除方法,详细分析了MySQL日志删除的步骤与相关注意事项,需要的朋友可以参考下
主要介绍了mysql 正确清理binlog日志的相关资料,需要的朋友可以参考下
linux常用脚本,实现获取一个指定区间内未被占用的随机端口号、查看日志大小、清理日志、离线自动安装mysql
传送门开启Binlog日志使用Binlog日志恢复数据启动Binlog利用binlog日志重做数据库操作通过binlog日志恢复表记录 开启Binlog日志 修改配置文件,并重启服务 vim /etc/my.cnf [mysqld] server_id=1 #指定server_id ...
delete-revision清理 Revision 日志插件 for WordPress 由烈火下载免费提供! wordpress 从2.6 版本开始,加入了Post Revision/日志修订版本功能,这本来是一个很不错的功能,尤其对于多用户博客来说,比如Drupal 中...
sql200020052008日志清理sql200020052008日志清理sql200020052008日志清理
聪哥创作的一款批量保留路径清理代码注释的工具,目前兼容大部分常见的代码注释,涵盖c、java、python、php、js、html、css、mysql、node、vue、ruby等常见编程项目的注释无损清理。 2023年8月19日更新日志: 1.对...
护卫神·挂马清理工具是针对目前网页或数据库频繁被挂马的情况,我们特别开发的一款专业批量清理网页、Access数据库、SQL Server数据库和MySQL数据库挂马代码的实用软件,绿色免费;迅速帮您从海量文件和数据中清理...
由于项目需要,每个月的历史存量数据需要进行一个归档和备份操作,以及一些日志表需要进行一个明细字段清除,让mysql数据库磁盘节省空间。则需要一些定时任务来定时清理这些数据。 2|0技术选型 Java 可以基于...