本来我想记录慢查询:
【my.cnf】
slow_query_log = /var/lib/mysql/slowquery.log  ##慢查询日志文件
     long_query_time = 3  ###慢查询时间
     log-queries-not-using-indexes
[Warning] options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-sl        ave-statements have no effect if --log_slow_queries is not set重启有这个警告 
意思是 log_slow_queries 这个没设置 索引的就没作用:
然后我设置log_slow_queries
重启;
 [Warning] '--log_slow_queries' is deprecated and will be removed in a future release. Please use         ''--slow_query_log'/'--slow_query_log_file'' instead.又说 log_slow_queries  过时了!!现在该怎么正确的设置呢? 
我想的到超过3秒的记录下sql语句 或者 没有索引的查询也记录下来!

解决方案 »

  1.   

    1  开慢查询不用重启2  根本用不到log-queries-not-using-indexes这个参数
    只需要set global slow_query_log=on;就可以了
      

  2.   


    我是直接编辑的my.cnf 这也是一样的撒 然后我还想记录没有索引的查询 不是要用到这个参数吗? log-queries-not-using-indexes 
      

  3.   

    用不到log-queries-not-using-indexs此参数的。
    只启用slow_query_log=on就可以了。
      

  4.   

    --log_slow_queries' is deprecated 只是一个warning,它还是会生效的,当然,你最好是用它建议的
    --slow_query_log
    --slow_query_log_file
    正确的用法是:
    slow_query_log
    slow_query_log_file=/var/lib/mysql/slowquery.log
    log-queries-not-using-indexes其中log-queries-not-using-indexes会记录所有没有用上索引全表扫描的语句,就算你的SQL没有超过long_query_time设置的时间。有些只有一二十条记录的表全表扫描并不是什么大事也会记录到你的慢查日志中,对慢查分析有一定的坏处,你需要斟酌加上这个参数。
      

  5.   

    MYSQL的版本是什么? 有些参数在不同版本中稍有不同。