Solved

log_slow_queries not working

Posted on 2008-10-10
3
970 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
ID: 22693041
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
ID: 22694814
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
ID: 22706504
Figured out the problem - I was restarting apache not mysql after making the changes.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL inner join confusion 15 55
MS Access - need to reduce row size 25 61
Present Absent from working date rage 11 38
Very Large data in MYSQL 7 74
Fore-Foreword Today (2016) Maxmind has a new approach to the distribution of its data sets.  This article may be obsolete.  Instead of using the examples here, have a look at the MaxMind API (https://www.maxmind.com/en/geolite2-developer-package). …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

820 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