long_query_time=10 超过该配置时间的 SQL 语句将会被记录,时间是秒
slow_query_log=1 表示开启慢查询记录
#以前版本的参数格式跟5.6的不一致
slow_query_log_file=/data/mysql/data/mysql-master-slow.log
#将所有没有使用带索引的查询语句全部写到慢查询日志中
log_queries_not_using_indexes=1
show variables like '%slow%';
show variables like '%index%';
写入到表 mysql.slow_log
select @@global.log_output;
set @@global.log_output='TABLE';