美文网首页
2022-06-07 mysql 全局日志(general_l

2022-06-07 mysql 全局日志(general_l

作者: netppp | 来源:发表于2022-06-07 22:38 被阅读0次

    基本命令
    查看日志是否开启

    show variables like 'general_log';
    开启日志功能

    set global general_log=on;
    查看日志文件保存位置

    show variables like 'general_log_file';
    设置日志文件保存位置

    set global general_log_file='/tmp/mysql_general.log';
    查看日志输出类型 table或file

    show variables like 'log_output';
    设置输出类型为 table

    set global log_output='table';
    设置输出类型为file

    set global log_output='file';
    开启数据库general_log步骤
    set global general_log=on;
    set global log_output='file';
    set global general_log_file='/tmp/mysql_general.log';
    sudo cat /tmp/mysql_general.log
    /usr/sbin/mysqld, Version: 8.0.25-0ubuntu0.20.04.1 ((Ubuntu)). started with:
    Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
    Time Id Command Argument
    2021-07-18T08:53:04.925394Z 46 Query SELECT DATABASE()
    2021-07-18T08:53:04.925630Z 46 Init DB school_info
    2021-07-18T08:53:04.926313Z 46 Query show databases
    2021-07-18T08:53:04.927244Z 46 Query show tables
    2021-07-18T08:53:04.928407Z 46 Field List class
    2021-07-18T08:53:04.928536Z 46 Field List lock_myisam
    2021-07-18T08:53:04.928677Z 46 Field List school
    2021-07-18T08:53:04.928762Z 46 Field List student
    2021-07-18T08:53:04.928853Z 46 Field List test5
    2021-07-18T08:53:06.874598Z 46 Query select * from student where id=1
    2021-07-18T08:53:08.992675Z 46 Quit

    http://www.manongjc.com/detail/25-uvskbydwsunwgxf.html

    相关文章

      网友评论

          本文标题:2022-06-07 mysql 全局日志(general_l

          本文链接:https://www.haomeiwen.com/subject/akjymrtx.html