mysql设置打开日志及清除日志
////////////update x2_exercise set exernumber=28,exerqutype=1 where exeruserid = '5' AND exerbasicid = '5' ; 单选题第28题;
////////////update x2_exercise set exernumber=23,exerqutype=2 where exeruserid = '5' AND exerbasicid = '5' ; 多选题第23题;
SET GLOBAL log_output = 'TABLE';
SET GLOBAL general_log = 'ON';
SELECT * from mysql.general_log ORDER BY event_time DESC;
SET GLOBAL general_log = 'OFF';
RENAME TABLE mysql.general_log TO mysql.general_log2;
DELETE FROM mysql.general_log2;
清除日志:
开启mysql的日志功能,包扩通用日志和满日志方法参考琼杰笔记:
方法1: SET GLOBAL general_log = 'OFF';
RENAME TABLE mysql.general_log TO mysql.general_log2;
DELETE FROM mysql.general_log2;
注意:当DELETE FROM mysql.general_log2执行删除表数据时,发现操作系统的数据文件还是存在的,需要手动删除该数据文件,再继续下面数据操作步骤
OPTIMIZE TABLE general_log2;
RENAME TABLE mysql.general_log2 TO mysql.general_log;
SET GLOBAL general_log = 'ON';
这种方法需要的时间比较长
方法2:
SET GLOBAL general_log = 'OFF';
找到general_log的文件 执行 cat /dev/null > general_log.csv 发现也将大小释放了,比上一个快很多 方法
3: 可以在配置文件my.conf 中添加: general_log=1 general_log_file='/data/mysql/general_log.CSV'
将文件放到更大的磁盘 ————————————————
版权声明:本文为CSDN博主「weixin_39780784」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/weixin_39780784/article/details/113143278