MySQL慢查询
来源:互联网 发布:js什么是冒泡事件 编辑:程序博客网 时间:2024/06/11 06:24
MySQL慢查询对查找性能瓶颈的SQL很有用,下面来看看如何开启MySQL慢查询操作:
[root@yunuo_vm ~]# mysql -u root -pEnter password:Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 4977Server version: 5.6.17 Source distribution Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
ps:这里的MySQL版本是5.6.17
OK,进入到控制台了,接下来,我们查看下MySQL默认配置中多少秒才算慢查询
mysql> show variables like 'long%';+-----------------+-----------+| Variable_name | Value |+-----------------+-----------+| long_query_time | 10.000000 |+-----------------+-----------+1 row in set (0.00 sec)
如上表显示,系统默认的慢查询时间上限是10秒,下面我们来把它改成1秒(大家也可以根据自己实际情况来定);
mysql> set long_query_time=1; 注: 我设置了1, 也就是执行时间超过1秒的都算慢查询。Query OK, 0 rows affected (0.00 sec)
哦了!最后我们来瞅瞅MySQL开启慢查询日志记录没有;
mysql> show variables like 'slow%';+---------------------+---------------+| Variable_name | Value |+---------------------+---------------+| slow_launch_time | 2 | | slow_query_log | OFF || slow_query_log_file | /tmp/slow.log |+---------------------+---------------+
ps:
slow_query_log //是否打开日志记录
slow_query_log_file //日志存放位置
MySQL默认没有开启慢查询,下面我们来开启下:
mysql> set global slow_query_log='ON';Query OK, 0 rows affected (0.00 sec)
阅读全文
0 0
- mysql 慢查询分析
- mysql 慢查询
- mysql 查询慢分析
- mysql慢查询设置
- mysql 慢查询分析
- mysql 开启慢查询
- MYSQL - 慢查询日志
- MySQL慢查询
- mysql 慢查询
- MySQL开启慢查询
- mysql慢查询
- mysql慢查询设置
- Mysql 慢查询监听
- mysql 慢查询日志
- 开启Mysql 慢查询
- mysql 慢查询配置
- mysql慢查询
- Mysql 慢查询
- Object-C 面向对象基础
- uboot中Makefile的学习
- 【ACM模板】——hello_chengdongni 随着姿势提升,不定期补充
- ACM数论 板子
- arduino使用 iic协议控制16路pmw板的扩展
- MySQL慢查询
- 依赖注入与自动装配
- eclipse最常用的快捷键和TODO用法
- Unable to load configuration.
- Sublime Text3 简体中文汉化
- asp.net 获取GridView中a标签并进行操作
- CSS基础(一)入门
- linux-watch
- 136. Single Number 求数组中单一的数字