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);

  • 相关阅读:
    codeforces 349B Color the Fence 贪心,思维
    luogu_2022 有趣的数
    luogu_2320 [HNOI2006]鬼谷子的钱袋
    luogu_1879 [USACO06NOV]玉米田Corn Fields
    SAC E#1
    luogu_1984 [SDOI2008]烧水问题
    luogu_2085 最小函数值
    luogu_1631 序列合并
    luogu_1196 银河英雄传说
    luogu_1037 产生数
  • 原文地址:https://www.cnblogs.com/newmiracle/p/11865540.html
Copyright © 2011-2022 走看看