Solved

log_slow_queries not working

Posted on 2008-10-10
3
977 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Introduction In this article, I will by showing a nice little trick for MySQL similar to that of my previous EE Article for SQLite (http://www.sqlite.org/), A SQLite Tidbit: Quick Numbers Table Generation (http://www.experts-exchange.com/A_3570.htm…
Introduction In this installment of my SQL tidbits, I will be looking at parsing Extensible Markup Language (XML) directly passed as string parameters to MySQL 5.1.5 or higher. These would be instances where LOAD_FILE (http://dev.mysql.com/doc/refm…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

734 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