Mysql怎样开启binlog?
在lunix环境中开启binlog:
1.登录mysql,执行命令mysql -uroot -p 回车输入密码。
2.查看当前binlog是否开启,执行show variables like "%bin%"; 查看日志是否打开,log_bin为OFF说明未开启。
3.修改mysql配置文件来开启bin_log,通过 find / -name my.cnf 查找my.cnf路径
4.在[mysqld] 下面增加
log-bin = /var/log/mysql-bin.log
expire-logs-days = 14
max-binlog-size = 500M
server-id = 1
5.重启mysql
重启的方法
1、使用 service 启动:
service mysqld restart
service mysql restart (5.5.7版本命令)
2、使用 mysqld 脚本启动:
/etc/init.d/mysqld restart