GLOBAL variable and should be set with SET GLOBAL
来源:互联网 发布:centos 7 gitweb 编辑:程序博客网 时间:2024/05/13 19:25
方法1,用命令开启慢查询
查看复制打印?
1.mysql> show variables like "%long%"; //查看一下默认为慢查询的时间10秒
2.+-----------------+-----------+
3.| Variable_name | Value |
4.+-----------------+-----------+
5.| long_query_time | 10.000000 |
6.+-----------------+-----------+
7.1 row in set (0.00 sec)
8.
9.mysql> set global long_query_time=2; //设置成2秒,加上global,下次进mysql已然生效
10.Query OK, 0 rows affected (0.00 sec)
11.
12.mysql> show variables like "%slow%"; //查看一下慢查询是不是已经开启
13.+---------------------+---------------------------------+
14.| Variable_name | Value |
15.+---------------------+---------------------------------+
16.| log_slow_queries | OFF |
17.| slow_launch_time | 2 |
18.| slow_query_log | OFF |
19.| slow_query_log_file | /usr/local/mysql/mysql-slow.log |
20.+---------------------+---------------------------------+
21.4 rows in set (0.00 sec)
24.ERROR 1229 (HY000): Variable 'slow_query_log' is a GLOBAL variable and should be set with SET GLOBAL
25.mysql> set global slow_query_log='ON'; //启用慢查询
26.Query OK, 0 rows affected (0.28 sec)
27.
28.mysql> show variables like "%slow%"; //查看是否已经开启
29.+---------------------+---------------------------------+
30.| Variable_name | Value |
31.+---------------------+---------------------------------+
32.| log_slow_queries | ON |
33.| slow_launch_time | 2 |
34.| slow_query_log | ON |
35.| slow_query_log_file | /usr/local/mysql/mysql-slow.log |
36.+---------------------+---------------------------------+
37.4 rows in set (0.00 sec)
mysql> show variables like "%long%"; //查看一下默认为慢查询的时间10秒
+-----------------+-----------+
| Variable_name | Value |
+-----------------+-----------+
| long_query_time | 10.000000 |
+-----------------+-----------+
1 row in set (0.00 sec)
mysql> set global long_query_time=2; //设置成2秒,加上global,下次进mysql已然生效
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like "%slow%"; //查看一下慢查询是不是已经开启
+---------------------+---------------------------------+
| Variable_name | Value |
+---------------------+---------------------------------+
| log_slow_queries | OFF |
| slow_launch_time | 2 |
| slow_query_log | OFF |
| slow_query_log_file | /usr/local/mysql/mysql-slow.log |
+---------------------+---------------------------------+
4 rows in set (0.00 sec)
mysql> set slow_query_log='ON'; //加上global,不然会报错的。
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.28 sec)
mysql> show variables like "%slow%"; //查看是否已经开启
+---------------------+---------------------------------+
| Variable_name | Value |
+---------------------+---------------------------------+
| log_slow_queries | ON |
| slow_launch_time | 2 |
| slow_query_log | ON |
| slow_query_log_file | /usr/local/mysql/mysql-slow.log |
+---------------------+---------------------------------+
4 rows in set (0.00 sec)
查看复制打印?
1.mysql> show variables like "%long%"; //查看一下默认为慢查询的时间10秒
2.+-----------------+-----------+
3.| Variable_name | Value |
4.+-----------------+-----------+
5.| long_query_time | 10.000000 |
6.+-----------------+-----------+
7.1 row in set (0.00 sec)
8.
9.mysql> set global long_query_time=2; //设置成2秒,加上global,下次进mysql已然生效
10.Query OK, 0 rows affected (0.00 sec)
11.
12.mysql> show variables like "%slow%"; //查看一下慢查询是不是已经开启
13.+---------------------+---------------------------------+
14.| Variable_name | Value |
15.+---------------------+---------------------------------+
16.| log_slow_queries | OFF |
17.| slow_launch_time | 2 |
18.| slow_query_log | OFF |
19.| slow_query_log_file | /usr/local/mysql/mysql-slow.log |
20.+---------------------+---------------------------------+
21.4 rows in set (0.00 sec)
22. set character_set_results=utf8;
23.mysql> set slow_query_log='ON'; //加上global,不然会报错的。24.ERROR 1229 (HY000): Variable 'slow_query_log' is a GLOBAL variable and should be set with SET GLOBAL
25.mysql> set global slow_query_log='ON'; //启用慢查询
26.Query OK, 0 rows affected (0.28 sec)
27.
28.mysql> show variables like "%slow%"; //查看是否已经开启
29.+---------------------+---------------------------------+
30.| Variable_name | Value |
31.+---------------------+---------------------------------+
32.| log_slow_queries | ON |
33.| slow_launch_time | 2 |
34.| slow_query_log | ON |
35.| slow_query_log_file | /usr/local/mysql/mysql-slow.log |
36.+---------------------+---------------------------------+
37.4 rows in set (0.00 sec)
mysql> show variables like "%long%"; //查看一下默认为慢查询的时间10秒
+-----------------+-----------+
| Variable_name | Value |
+-----------------+-----------+
| long_query_time | 10.000000 |
+-----------------+-----------+
1 row in set (0.00 sec)
mysql> set global long_query_time=2; //设置成2秒,加上global,下次进mysql已然生效
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like "%slow%"; //查看一下慢查询是不是已经开启
+---------------------+---------------------------------+
| Variable_name | Value |
+---------------------+---------------------------------+
| log_slow_queries | OFF |
| slow_launch_time | 2 |
| slow_query_log | OFF |
| slow_query_log_file | /usr/local/mysql/mysql-slow.log |
+---------------------+---------------------------------+
4 rows in set (0.00 sec)
mysql> set slow_query_log='ON'; //加上global,不然会报错的。
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.28 sec)
mysql> show variables like "%slow%"; //查看是否已经开启
+---------------------+---------------------------------+
| Variable_name | Value |
+---------------------+---------------------------------+
| log_slow_queries | ON |
| slow_launch_time | 2 |
| slow_query_log | ON |
| slow_query_log_file | /usr/local/mysql/mysql-slow.log |
+---------------------+---------------------------------+
4 rows in set (0.00 sec)
- GLOBAL variable and should be set with SET GLOBAL
- Robot: Set Global/Suite/Test Variable
- global variable and local variable
- autosys set global viriables
- python global and local variable
- set global sql_slave_skip_counter=1
- [常见错误 及 解决方案系列]USE " cc.exports.* = value " INSTEAD OF SET GLOBAL VARIABLE"
- [常见错误 及 解决方案系列]USE " cc.exports.* = value " INSTEAD OF SET GLOBAL VARIABLE"
- lua常见异常 USE " cc.exports. = value " INSTEAD OF SET GLOBAL VARIABLE"
- ERROR 1840 (HY000) at line 24: @@GLOBAL.GTID_PURGED can only be set when @@GLOBAL.GTID_EXECUTED is e
- MySQL里的set global wait_timeout
- MySQL里的set global wait_timeout
- Failed global initialization: BadValue Invalid or no user locale set. Please ensure LANG and/or LC_*
- Qt global variable
- 055.Global Variable 全局变量
- 055.Global Variable 全局变量
- COBOL GLOBAL & EXTERNAL Variable
- Learning with Local and Global Consistency
- SQL里变量的声明以及常用函数举例
- 快速排序的随机化版本
- Android Hal 分析
- 关于Hadoop的3中运行模式的说明
- Windows下配置Apache虚拟主机(VirtualHost)
- GLOBAL variable and should be set with SET GLOBAL
- 找回密码了
- Attribute在.net编程中的应用(一)
- HTML5
- Poj 2253 Frogger
- 实验2-1 多种进制形式的整型数据的输入输出
- JBoss Seam架构师及开发设计工程师
- 美国搜索市场之战 微软终于战胜雅虎
- 四极管:IIC之AVR 24c64读写