标签:start variable variables oca version image comm out command
sql与索引优化
数据库表结构优化
系统配置
硬件
mysql> show variables like 'slow_query_log';
+----------------+-------+
| Variable_name | Value |
+----------------+-------+
| slow_query_log | OFF |
+----------------+-------+
1 row in set (0.00 sec)
慢日志查询没有开启,可以开启一下。
找到my.cnf,添加如下内容sudo vim /usr/local/mysql/my.cnf
# 添加慢查询日志
log_output=file
slow_query_log=on
slow_query_log_file = /tmp/mysql-slow.log
long_query_time = 2
重启mysql。
mysql> show variables like 'slow_query_log';
+----------------+-------+
| Variable_name | Value |
+----------------+-------+
| slow_query_log | ON |
+----------------+-------+
1 row in set (0.00 sec)
这时候再看,已经开启了慢查询日志。
$ sudo cat /tmp/mysql-slow.log
/usr/local/mysql/bin/mysqld, Version: 5.6.40-log (Source distribution). started with:
Tcp port: 3306 Unix socket: /tmp/mysql.sock
Time Id Command Argument
标签:start variable variables oca version image comm out command
原文地址:https://www.cnblogs.com/jiqing9006/p/9098181.html