Skip navigation links

MySQL Forums :: Newbie :: How to enable log_slow_queries and set value for long_query_time


Advanced Search

How to enable log_slow_queries and set value for long_query_time
Posted by: bala krishnan ()
Date: June 13, 2007 12:34AM

Hi

I want to set slow query log which consists of all SQL statements that took more than long_query_time seconds to execute.

Now default value is set for long_query_time ie 10. Show variables shows


log_slow_queries - OFF

long_query_time - 10

I want to enable log_slow_queries and set long_query_time =1

I found in mysql manual to set slow query log as follows in my.cnf


mysqld]
set-variable=long_query_time=1
log-slow-queries=/var/log/mysql/log-slow-queries.log


You must create the file manually and change owners this way:

mkdir /var/log/mysql
touch /var/log/mysql/log-slow-queries.log
chown mysql.mysql -R /var/log/mysql


Even after changing this in my.cnf, the show variables shows as

log_slow_queries - OFF

long_query_time - 10

It looks like same before


my.cnf settings are



[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
set-variable=long_query_time=1
log-slow-queries=/var/log/mysql/log-slow-queries.log

# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

[mysql.server]
user=mysql
basedir=/var/lib


[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid


~
~
"/etc/my.cnf" 21L, 454C



Any one say how to find slow log queries. I'm using RHEL 5 and MySQL 5.0.22

thanks

Options: ReplyQuote


Subject Written By Posted
How to enable log_slow_queries and set value for long_query_time bala krishnan 06/13/2007 12:34AM
Re: How to enable log_slow_queries and set value for long_query_time Hakan Kuecuekyilmaz 06/13/2007 01:41AM
Re: How to enable log_slow_queries and set value for long_query_time bala krishnan 06/13/2007 11:20PM
Re: How to enable log_slow_queries and set value for long_query_time Hakan Kuecuekyilmaz 06/16/2007 03:33AM
Re: How to enable log_slow_queries and set value for long_query_time bala krishnan 06/18/2007 01:34AM
Re: How to enable log_slow_queries and set value for long_query_time Hakan Kuecuekyilmaz 06/18/2007 02:53AM
Re: How to enable log_slow_queries and set value for long_query_time bala krishnan 06/18/2007 06:08AM
Re: How to enable log_slow_queries and set value for long_query_time Hakan Kuecuekyilmaz 06/20/2007 04:33AM
Re: How to enable log_slow_queries and set value for long_query_time Wenxing Zheng 07/09/2007 07:33PM
Re: How to enable log_slow_queries and set value for long_query_time Srikanth Pulikonda 07/10/2007 02:53PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.