Slow queries log for MySQL

| 2 Comments | No TrackBacks

To enable slow query log, it is have to add one line into my.cnf.

I have MySQL installation on a Centos server.
It is MySQL 5.0.22 i686.

Let's go through the details of setting of it.

Open my.cnf which is located at /etc/
add following under mysqld section.

log-slow-queries = /var/log/mysql/mysql-slow.log
long_query_time = 5
log-queries-not-using-indexes

The key point is to manually create the mysql-slow.log file.
cd /var/log
mkdir mysql
touch mysql-slow.log
chmod mysql.mysql -R /var/log/mysql

Last step is to restart mysql server.


After minutes, I saw some records in this log file.

The next question is how to analyse the slow queries log and optimize the program of MySQL.



No TrackBacks

TrackBack URL: http://www.yinfor.com/mt5cgi/mt-tb.cgi/2322

2 Comments

I think you mean chown instead of chmod

Hello,

Great post, but i think that the "chmod mysql.mysql -R /var/log/mysql" should be: "chown mysql.mysql -R /var/log/mysql"

Happy debuging

Leave a comment

About this Entry

This page contains a single entry by David Yin published on January 22, 2009 2:18 PM.

Obama's inaugural address was the previous entry in this blog.

How to Find Out Linux CPU Utilization? is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

OpenID accepted here Learn more about OpenID
Powered by Movable Type 5.01

Subscribe

Online Tools

Code Convertor