标签:global oca 设置 admin name sql info 技术 路径
mysql> show variables like ‘long_query_time‘;
+-----------------+-----------+
| Variable_name | Value |
+-----------------+-----------+
| long_query_time | 10.000000 |
+-----------------+-----------+
1 row in set (0.00 sec)
mysql> set long_query_time=0;
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like ‘long_query_time‘;
+-----------------+----------+
| Variable_name | Value |
+-----------------+----------+
| long_query_time | 0.000000 |
+-----------------+----------+
1 row in set (0.00 sec)
mysql> set log_queries_not_using_indexes=ON;
ERROR 1229 (HY000): Variable ‘log_queries_not_using_indexes‘ is a GLOBAL variable and should be set with SET GLOBAL
mysql> set global log_queries_not_using_indexes=true;
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like ‘log_queries_not_using_indexes‘;
+-------------------------------+-------+
| Variable_name | Value |
+-------------------------------+-------+
| log_queries_not_using_indexes | ON |
+-------------------------------+-------+
1 row in set (0.00 sec)
mysql> set slow_query_log_file=‘/vagrant/log/mysql/mysql-slow.log‘;
ERROR 1229 (HY000): Variable ‘slow_query_log_file‘ is a GLOBAL variable and should be set with SET GLOBAL
mysql> set global slow_query_log_file=‘/vagrant/log/mysql/mysql-slow.log‘;
Query OK, 0 rows affected (0.01 sec)
mysql> show variables like ‘slow_query_log_file‘;
+---------------------+-----------------------------------+
| Variable_name | Value |
+---------------------+-----------------------------------+
| slow_query_log_file | /vagrant/log/mysql/mysql-slow.log |
+---------------------+-----------------------------------+
1 row in set (0.00 sec)
mysql> show variables like ‘%slow%‘;
+---------------------------+--------------------------------------------------+
| Variable_name | Value |
+---------------------------+--------------------------------------------------+
| log_slow_admin_statements | OFF |
| log_slow_slave_statements | OFF |
| slow_launch_time | 2 |
| slow_query_log | OFF |
| slow_query_log_file | /usr/local/mysql/data/vagrant-c5-x86_64-slow.log |
+---------------------------+--------------------------------------------------+
5 rows in set (0.00 sec)
mysql> set slow_query_log=on;
ERROR 1229 (HY000): Variable ‘slow_query_log‘ is a GLOBAL variable and should be set with SET GLOBAL
mysql> set global slow_query_log=on;
Query OK, 0 rows affected (0.09 sec)
mysql> show variables like ‘slow_query_log‘;
+----------------+-------+
| Variable_name | Value |
+----------------+-------+
| slow_query_log | ON |
+----------------+-------+
1 row in set (0.00 sec)
在 [mysqld] 添加配置
long_query_time = 0.1 //100毫秒
log-slow-queries = /vagrant/log/mysql/mysql-slow.log
接着重启mysql
/etc/init.d/mysql restart
[vagrant@vagrant-c5-x86_64 bin]$ sudo ./mysqldumpslow -s r -t 20 /usr/local/mysql/data/vagrant-c5-x86_64-slow.log
标签:global oca 设置 admin name sql info 技术 路径
原文地址:https://www.cnblogs.com/biby/p/13661515.html