错误日志
show variables like '%log_error%';
show variables like '%log_warings%';
查询日志
存储查询日志方式
1.将存储日志放于指定的日志文件中
2.将存储日志存放于mysql.genelral_log表中
3.将查询日志同时存放于指定的日志文件与mysql库的general_log表中

#查看查询日志的相关参数
> show variables where variable_name like "%general_log%" or variable_name="log_output";

set globle general_log=on;
set global log_output="file,table";
慢查询日志
set global slow query log=ON;
show variables where variable_name like "%slow_query%" or variable_name="log_output"
show variables like "log_slow_quer%";
show status like "%log_slow_quer%";

mysqldumpslow命令  慢查询日志的统计分析工具
> mysqldumpslow  -s t /var/lib/mysql/cos72ini-slow.log
#根据语句的执行次数进行排序
> mysqldumpslow  -s c /var/lib/mysql/cos72ini-slow.log
#根据语句的返回记录数量进行排序
> mysqldumpslow  -s r /var/lib/mysql/cos72ini-slow.log

c:执行计数 
l:锁定时间
r:返回记录
t:执行时间
al:平均锁定时间
ar:平均返回记录数
at:平均执行时间
二进制日志
主要用于时间点恢复(备份恢复)

mysqlbinlog 命令

相关文章:

  • 2021-04-11
  • 2021-12-06
  • 2022-02-11
  • 2021-11-26
  • 2021-09-23
  • 2022-01-10
  • 2021-11-26
  • 2021-12-30
猜你喜欢
  • 2021-04-18
  • 2022-01-07
  • 2021-11-16
  • 2021-07-08
  • 2021-06-03
  • 2022-12-23
相关资源
相似解决方案