my.cnf 是windows环境下的配置文件,my.ini是linux下的配置文件
可以,配置文件只是相当于启动时的参数,没有参数时,以默认参数进行。
show variables like 'slow_query%';
set global slow_query_log='ON';
show global status like '%slow_queries%';
select sleep(10);
// 查看当前会话的,如果修改成功,也不会看到改变,(等个几秒,重开一个窗口,执行命令,才能看见)
show variables like 'long_query_time';
// 查看全局会话慢日志时间,修改前后,一致。
show global variables like 'long_query_time';
set global long_query_time=5;
查看慢日志的类型
show variables like '%log_output%';
设置为:FILE
set global log_output = 'File'
设置为:TABLE
set global log_output = 'TABLE'
查看是否开启
show variables like 'log-queries-not-using-indexes';
设置开启
set global log_queries_not_using_indexes=1;
例如:
# 在my.ini文件内修改或添加
global slow_query_log = 1
slow_query_log_file = C:\phpStudy\PHPTutorial\MySQL\data\DESKTOP-AFSBV9C-slow.log
特殊说明: 解决问题的光鲜,藏着磕Bug的痛苦。 万物皆入轮回,谁也躲不掉! 以上文章,均是我实际操作,写出来的笔记资料,不会出现全文盗用别人文章!烦请各位,请勿直接盗用!