Solved

log_slow_queries not working

Posted on 2008-10-10
3
944 Views
Last Modified: 2012-05-05
I'm trying to enable the logging of slow queries on a server...

Here's what I've done:

1. Created a log file : var/log/slowQueryLog.log
2. ran command: touch slowQueryLog.log
3. ran command: chown mysql:mysql slowQueryLog.log
4. Added log_slow_queries to etc/my.cnf (see code below)
5. Stopped and restarted mysql
6. Ran a really long query
7. Checked the log - empty  : (

Am I missing something?
[mysqld]

safe-show-database

innodb_data_file_path=ibdata1:10M:autoextend

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

tmpdir=/var/tmp
 

log_slow_queries=/var/log/slowQueryLog.log

long_query_time=1
 
 
 

#set-variable = sort_buffer_size=4M

#set-variable = query-cache-type = 1

#set-variable = query-cache-size = 20M

#set-variable = key_buffer_size= 64M

#skip-innodb

skip-networking
 

[mysql.server]

user=mysql

basedir=/var/lib			
 
 
 

[safe_mysqld]

err-log=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

Open in new window

0
Comment
Question by:susanBuck
  • 2
3 Comments
 
LVL 20

Accepted Solution

by:
Muhammad Wasif earned 500 total points
Comment Utility
Which mysql version you are using?
Make sure you have only one my.cnf file on the server and you are editing the correct one. Do not use log file name and just define log_slow_queries to see if is it working or not.
0
 

Author Comment

by:susanBuck
Comment Utility
mysql version 4.1.22

when I run locate my.cnf I get:
/home/ian/.my.cnf
/etc/my.cnf  <<<<<<<<<<< This is the one i'm editing
/etc/my.cnf.rpmsave
/etc/my.cnf.bak
/etc/.my.cnf.swp

Also, when I run my_print_defaults mysqld I get:
--safe-show-database
--innodb_data_file_path=ibdata1:10M:autoextend
--datadir=/var/lib/mysql
--socket=/var/lib/mysql/mysql.sock
--tmpdir=/var/tmp
--log_slow_queries=/var/log/slowQueryLog.log
--long_query_time=1
--skip-networking
Confirming it's in the right place.

Went ahead and did what you said - got rid of the log file name. Restarted apache, ran my long query, then look to see if it created a log anywhere on the server ( "locate slow" )... but nothing...
0
 

Author Comment

by:susanBuck
Comment Utility
Figured out the problem - I was restarting apache not mysql after making the changes.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

A lot of articles have been written on splitting mysqldump and grabbing the required tables. A long while back, when Shlomi (http://code.openark.org/blog/mysql/on-restoring-a-single-table-from-mysqldump) had suggested a “sed” way, I actually shell …
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now