Mysql bin log 清理

查看binlog

查看binlog日志状态

  show variables like '%log_bin%';

查看已生产的mysql-binlog日志

  show binary logs;

 

清除binlog
binlog 日志已经影响到了磁盘空间 , 那么你将使用下面命令清除
mysql> reset master; # 清空所有 binlog 文件
mysql 还做了主从同步 , 那么上面的命令就不适合你了 , 因为 binlog 文件删除过多的话 , 会导致数据不同步

mysql> show slave status\G # 你首先要来 slave 上查看从库读 binlog 到了哪里
Master_Log_File: mysql-bin.000009 # 我们可以看到是 mysql-bin.000009

mysql> purge master logs to 'mysql-bin.000009'; # 我们可以在 master 中执行这条指令 , 将 binlog 文件删除至 mysql-bin.000009 前

mysql> purge master logs before '2014-11-18 00:00:00'; # 将 binlog 文件删除至此日期前

https://blog.csdn.net/apple_74262176/article/details/140619504

https://www.jb51.net/article/277476.htm

https://blog.csdn.net/fhw925464207/article/details/131838862

posted @   CrazyJC  阅读(58)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
点击右上角即可分享
微信分享提示