Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

log_slow_queries not working

Posted on 2008-10-10
3
Medium Priority
?
995 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 2000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
In this article, we’ll look at how to deploy ProxySQL.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

715 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