基本命令查看⽇志是否开启
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.sockTime Id Command Argument
2021-07-18T08:53:04.925394Z 46 Query SELECT DATABASE()2021-07-18T08:53:04.925630Z 46 Init DB school_info2021-07-18T08:53:04.926313Z 46 Query show databases2021-07-18T08:53:04.927244Z 46 Query show tables2021-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=12021-07-18T08:53:08.992675Z 46 Quit
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- huatuowenda.com 版权所有 湘ICP备2023022495号-1
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务