zoukankan      html  css  js  c++  java
  • mysql慢查询日记

    mysql慢查询日记

    <pre>
    #必须写到mysqld 注意给/tmp/showslowmysql.log 775权限 要写入权限
    [mysqld]
    #开启慢查询日记
    slow_query_log = 1
    #设置日记路径
    slow_query_log_file = /tmp/showslowmysql.log
    #超过1秒 就代表慢查询记录到日志
    long_query_time=1

    mysql> show variables like '%query%';
    +------------------------------+------------------------+
    | Variable_name | Value |
    +------------------------------+------------------------+
    | binlog_rows_query_log_events | OFF |
    | ft_query_expansion_limit | 20 |
    | have_query_cache | YES |
    | long_query_time | 1.000000 |
    | query_alloc_block_size | 8192 |
    | query_cache_limit | 1048576 |
    | query_cache_min_res_unit | 4096 |
    | query_cache_size | 1048576 |
    | query_cache_type | OFF |
    | query_cache_wlock_invalidate | OFF |
    | query_prealloc_size | 8192 |
    | slow_query_log | ON |
    | slow_query_log_file | /tmp/showslowmysql.log |
    +------------------------------+------------------------+
    13 rows in set
    </pre>


    运行mysql语句select sleep(1);

    然后查看慢查询日志 cat /tmp/showslowmysql.log
    # Time: 170516 14:46:47
    # User@Host: root[root] @ [122.224.247.131] Id: 67
    # Query_time: 1.000352 Lock_time: 0.000000 Rows_sent: 1 Rows_examined: 0
    SET timestamp=1494917207;
    select sleep(1);

  • 相关阅读:
    如何将一个整数分散成百分位、千分位等
    好用的竖直无缝滚动
    图片轮播插件
    新浪sae授权流程的理解
    js和php对数字格式化
    控制input表单的输入的字数
    真实的恐怖(转载)
    日本的寒暑假+春假
    也不知道你今天的路线是怎么样的
    关于中日区别
  • 原文地址:https://www.cnblogs.com/newmiracle/p/11865540.html
Copyright © 2011-2022 走看看