赞
踩
一:查看日志是否开启
1、show variables where Variable_name = 'general_log';
2、show variables like 'general_log';
二:开启和关闭的sql:
1、set global general_log=on;
2、set global general_log=off;
三:查看log文件所在位置
1、show variables where Variable_name='general_log_file';
2、show variables like 'general_log_file';
四:修改log文件所在位置
1、set global general_log_file='tmp/mysql_log.log';
五:日志输出类型table或file
1、show variables like 'log_output';
六:修改日志输出类型
1、set global log_output='table';
2、set global log_output='file';
一:查看慢查询设置
1、show variables like "%slow%";
二:启用慢查询:
1、set global slow_query_log=ON;
2、set global slow_query_log=OFF;
三: 设置成2秒,加上global,下次进mysql已然生效:
1、set global long_query_time=2;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。