Home  >  Article  >  Database  >  mysql 关闭 bin-log 日志

mysql 关闭 bin-log 日志

WBOY
WBOYOriginal
2016-06-07 16:38:291512browse

当开启bin-log日志时,会生成很多mysql-bin.0000*类似的文件,而且可能会占用很大的硬盘空间。对于自己的测试机器或硬盘比较紧张的vps,而又不需要做master,slave的配置,完全可以关闭日志功能。 关闭操作很简单,找到配置文件my.cnf,对于linux,一般默认

当开启bin-log日志时,会生成很多mysql-bin.0000*类似的文件,而且可能会占用很大的硬盘空间。对于自己的测试机器或硬盘比较紧张的vps,而又不需要做master,slave的配置,完全可以关闭日志功能。

关闭操作很简单,找到配置文件my.cnf,对于linux,一般默认在/etc目录下,打开此文件,使用井号(#)注释掉如下两个配置项目即可。

log-bin=mysql-bin
binlog_format=mixed

配置修改好后需要重启mysqld服务才能生效。可能在重启时候会收到一个错误,“ERROR 1186 (HY000): Binlog closed, cannot RESET MASTER”,解决办法是先登入到mysql命令行中执行 reset master 即可。reset master的用途就是删除先前所以的bin-log日志文件。所以在master、slave配置环境中慎用此命令。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:hadoop学习-前记Next article:MMS 用户和组管理(15)