mariadb的日志

缘由:客户环境上莫名出现资源消失,数据库不知道什么时候做了这个操作,所以去补充了数据库日志相关的知识

官网:https://mariadb.com/kb/en/overview-of-mariadb-logs/

日志类别
The error log
  • Always enabled
  • Usually a file in the data directory, but some distributions may move
    this to other locations.
  • All critical errors are logged here.
  • One can get warnings to be logged by setting log_warnings.
  • With the mysqld_safe --syslog option one can duplicate the messages
    to the system’s syslog.
General query log
  • Enabled with --general-log
  • Logs all queries to a file or table.
  • Useful for debugging or auditing queries.
  • The super user can disable logging to it for a connection by setting SQL_LOG_OFF to 1.
Slow Query log
  • Enabled by starting mysqld with --slow-query-log
  • Logs all queries to a file or table.
  • Useful to find queries that causes performance problems.
  • Logs all queries that takes more than long_query_time to run.
  • One can decide what to log with the options --log-slow-admin-statements, --log-slow-- -slave-statements, log_slow_filter or log_slow_rate_limit.
  • One can change what is logged by setting log_slow_verbosity.
  • One can disable it globally by setting global.slow_query_log to 0
  • In 10.1 one can disable it for a connection by setting local.slow_query_log to 0.
The binary log
  • Enabled by starting mysqld with --log-bin
  • Used on machines that are, or may become, replication masters.
  • Required for point-in-time recovery.
  • Binary log files are mainly used by replication and can also be used with mysqlbinlog to apply on a backup to get the database up to date.
  • One can decide what to log with --binlog-ignore-db=database_name or --binlog-do-db=database_name.
  • The super user can disable logging for a connection by setting SQL_LOG_BIN to 0. - --However while this is 0, no changes done in this connection will be replicated to the slaves!
  • For examples, see Using and Maintaining the Binary Log.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值