pzblog

Mysql - 开启日志

来看下慢查询的开启。

[mysqld]

port=3306
log=D:/mysql.log
log_slow_queries=C:/temp/mysql_slow.log
long_query_time=1

show binary logs;

//查看binlog日志
show binlog events in \'mysql-bin.000181\';

查看日志是否开启
1).可以通过Mysql配置文件my.cnf来确认(Mysql默认开启二进制日志记录):
Replication Master Server (default)
binary logging is required for replication
log-bin=mysql-bin
刷新日志
flush logs;
查看当前日志位置
show master status;
查看当前所有日志
show master logs;
清空所有的bin-log日志
reset master;

查看日志内容
mysqlbinlog –no-defaults mysql-bin.00001;
删除bin-log
mysql> purge binary logs to \'ablelee.000003\';
Query OK, 0 rows affected (0.16 sec)
关闭 bin-log 日志
找到配置文件my.cnf,对于linux,一般默认在/etc目录下,打开此文件,使用井号(#)注释掉如下两个配置项目即可。
log-bin=mysql-bin
binlog_format=mixed
显示所有日志
mysql> show binary logs;

//查看所有日志
show binary logs;
//查看正在使用的binlog
show master status;

purge binary logs to \'mysql-tb-bin.000005\';
这个命令就是清理除mysql-tb-bin.000005以外的其他二进制日志;

//查看binlog日志
show binlog events in \'mysql-bin.000181\';

分类:

技术点:

相关文章:

  • 2022-02-08
  • 2022-02-08
  • 2021-12-03
  • 2022-02-17
  • 2021-08-12
  • 2021-09-03
  • 2021-07-19
猜你喜欢
  • 2021-11-20
  • 2022-02-11
  • 2022-02-08
  • 2022-01-02
  • 2021-12-16
  • 2021-07-02
  • 2021-12-05
相关资源
相似解决方案