• 周五. 2月 23rd, 2024

5G编程聚合网

5G时代下一个聚合的编程学习网

热门标签

查看mysql二进制文件(binlog文件)【报错+解决办法】

admin

11月 28, 2021

###

1、开启binlog

1.1、查看binlog列表报错 

查看binlog文件列表(报错)
    mysql> show binary logs;
    ERROR 1381 (HY000): You are not using binary logging

引起错误原因 mysql
> show variables like 'log_bin'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | log_bin | OFF | +---------------+-------+ 1 row in set (0.06 sec)

 1.2、查看binlog(报错)解决办法 – 开启binlog记录功能

修改mysql配置文件<在mysqld下添加下列三行内容>
    [root@mysql ~]# vim /etc/my.cnf 
    [mysqld]
    server-id = 6# expire_logs_days=5log-bin=/home/wx/mysql/mysql_bin/my_bin
    。。。。。
# 附加注释:
  1、自定义/home/wx/mysql/mysql_bin目录需要创建
    mkdir -p /home/wx/mysql/mysql_bin
  2、授权目录为mysql启动用户
    chown -R mysql.mysql /home/wx/mysql/mysql_bin
  3、重启mysql

1.3、查看binlog是否开启,mysql命令查看binlog列表(问题解决)

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

mysql> show binary logs;
+---------------+-----------+
| Log_name      | File_size |
+---------------+-----------+
| my_bin.000001 |       177 |
| my_bin.000002 |       154 |
+---------------+-----------+
2 rows in set (0.00 sec)

  1.4、查看binlog日志保存时间

mysql> show variables like '%expire_logs_days%';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| expire_logs_days | 5     |
+------------------+-------+
1 row in set (0.00 sec)

###

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注