盾怪网教程:是一个免费提供流行杀毒软件教程、在线学习分享的学习平台!

详细介绍Mysql中的4种日志

时间:2025/3/9作者:未知来源:盾怪网教程人气:

[摘要]+---------------+---------------修改错误日志的地址可以在/etc/my.cnf中添加--log-error = [filename]来开启mysql错误日志。我的是:...
+---------------+---------------
  • 修改错误日志的地址可以在/etc/my.cnf中添加--log-error = [filename]来开启mysql错误日志。我的是:

     log_error = /tmp/mysql.log
  • 先来查看一下:tail -f /tmp/mysql.log

    bash-3.2# tail -f /tmp/mysql.log 
    2015-12-23T02:22:41.467311Z 0 [Note] IPv6 is available.
    2015-12-23T02:22:41.467324Z 0 [Note]   - '::' resolves to '::';
    2015-12-23T02:22:41.467350Z 0 [Note] Server socket created on IP: '::'.
    2015-12-23T02:22:41.584287Z 0 [Note] Event Scheduler: Loaded 0 events
    2015-12-23T02:22:41.584390Z 0 [Note] /usr/local/Cellar/mysql/5.7.9/bin/mysqld: ready for connections.
    Version: '5.7.9'  socket: '/tmp/mysql.sock'  port: 3306  Homebrew
    2015-12-23T02:22:42.540786Z 0 [Note] InnoDB: Buffer pool(s) load completed at 151223 10:22:42
    151223 10:22:51 mysqld_safe A mysqld process already exists
    2015-12-23T02:25:30.984395Z 2 [ERROR] Could not use /tmp/mysql_query.log for logging (error 13 - Permission denied). Turning logging off for the server process. To turn it on again: fix the cause, then either restart the query logging by using "SET GLOBAL GENERAL_LOG=ON" or restart the MySQL server.
    2015-12-23T07:28:03.923562Z 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 61473ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.)
  • 信息量比较大,暂不分析了。。。。当然 如果mysql配置或连接出错时, 仍然可以通过tail -f 来跟踪日志的

    二、General Query Log

    记录mysql的日常日志,包括查询、修改、更新等的每条sql。

    • 先查看mysql是否启用了查询日志: show global variables like "%genera%"

      mysql> show global variables like "%genera%";
      +----------------------------------------+----------------------+
      

    关键词:详细介绍Mysql中的4种日志




    Copyright © 2012-2018 盾怪网教程(http://www.dunguai.com) .All Rights Reserved 网站地图 友情链接

    免责声明:本站资源均来自互联网收集 如有侵犯到您利益的地方请及时联系管理删除,敬请见谅!

    QQ:1006262270   邮箱:kfyvi376850063@126.com   手机版