
登录mysql数据库
mysql -u root -p
检查日志功能是否开启
show variables like 'log_%';
log_bin为OFF,表明binlog日志未开启
查找mysql的配置文件my.cnf的路径
find / -name my.cnf
默认的路径:etc/my.cnf
在[mysqld]下面增加
log-bin=mysql-bin #开启日志文件
expire_logs_days=3 #3天自动清理日志

重启mysql
[root@izuf6eojtvpmlr8e2wkpntz ]# systemctl stop mysqld
[root@izuf6eojtvpmlr8e2wkpntz ]# systemctl start mysqld
记得要查看下mysql的进程,有可能启动报错或者启动不了
登录mysql查询binlog日志是否开启,ON表示开启成功
show variables like 'log_%';


网友评论