3

MySQL8.0关闭bin-log

 2 years ago
source link: https://foofish.net/close-bin-log.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
MySQL8.0关闭bin-log - FooFish

今天查日志,发现MySQL目录占用的空间巨大,细查发现几十个1G多大的binlog文件。

微信截图_20210601223104.png

binlog 日志记录了数据库中的数据变动情况,包括增删查改。如果你开启了主从服务,或者开启了log-bin日志服务,就会有该日志的产生。

如果数据库没有使用主从服务的话,binlog没必要开启

mysql> show variables like 'log_bin'; 
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_bin       | ON    |
+---------------+-------+
1 row in set (0.00 sec)
————————————————

但是在 MySQL8.0 中,binlog开关默认已开启,所以你在 my.conf 文件中是找不到该配置项的。禁用 bin-log 功能在 my.conf 中添加

disable-log-bin

# 5.x 版本使用下面配置
log-bin=Off

有问题可以扫描二维码和我交流

关注公众号「Python之禅」,回复「1024」免费获取Python资源

python之禅

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK