<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>系统运维 &#187; binlog</title>
	<atom:link href="http://www.osyunwei.com/archives/tag/binlog/feed" rel="self" type="application/rss+xml" />
	<link>https://www.osyunwei.com</link>
	<description>国产化OS/AnolisOS/openEuler/RHEL/CentOS/Rocky Linux/Debian/Ubuntu Linux FreeBSD 服务器教程 &#124; Windows Server 2003/2008/2012/2016/2019/2022/2025服务器教程</description>
	<lastBuildDate>Tue, 14 Apr 2026 10:59:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>自动清理MySQL binlog日志</title>
		<link>https://www.osyunwei.com/archives/9732.html</link>
		<comments>https://www.osyunwei.com/archives/9732.html#comments</comments>
		<pubDate>Sat, 08 Oct 2016 07:53:15 +0000</pubDate>
		<dc:creator>qihang01</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[binlog]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.osyunwei.com/?p=9732</guid>
		<description><![CDATA[说明： 开启MySQL binlog日志的服务器，如果不设置自动清理日志，默认binlog日志一直保留着，时间一长，服务器磁盘空间被binlog日志占满，导致MySQL数据库出错。 使用下面方法可以安全清理binlog日志 一、没有主从同步的情况下清理日志 mysql -uroot -p123456 -e 'PURGE MASTER LOGS BEFORE DATE_SUB( NOW( ),INTERVAL 5 DAY)'; #mysql 定时清理5天前的binlog mysql -u root -p  #进入mysql 控制台 reset master;  #重置binlog 二、MySQL主从同步下安全清理binlog日志 1、mysql  -u root -p   #进入从服务器mysql控制台 show slave status\G;   #检查从服务器正在读取哪个日志，有多个从服务器，选择时间最早的一个做为目标日志。 2、进入主服务器mysql控制台 show master log;   #获得主服务器上的一系列日志 PURGE MASTER LOGS TO 'binlog.000058';   #删除binlog.000005之前的，不包括binlog.000058 PURGE MASTER LOGS [...]<p><a rel="bookmark" href="https://www.osyunwei.com/archives/9732.html" target="_blank">查看全文</a></p>]]></description>
		<wfw:commentRss>https://www.osyunwei.com/archives/9732.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
