How to enable slow querries

Post Reply
a24uall
Site Admin
Posts: 166
Joined: Sun Jul 01, 2012 9:07 am

How to enable slow querries

Post by a24uall »

Open my.cnf
vi /etc/my.cnf
Under "[mysqld]" copy the details below :
[mysqld]
log-slow-queries = ON
long_query_time=1
log-slow-queries=/var/lib/mysql/log-slow-queries.log
You must create the file manually and change ownership :
touch /var/lib/mysql/log-slow-queries.log
chown mysql.mysql /var/lib/mysql/log-slow-queries.log
Restart mysql
/etc/init.d/mysql restart
Check the logs :
tail -f /var/lib/mysql/log-slow-queries.log
Arun
WebhostingDevelopment.com
a24uall
Site Admin
Posts: 166
Joined: Sun Jul 01, 2012 9:07 am

Re: How to enable slow querries

Post by a24uall »

Log query when set to 3 the result is as mentioned below :
=====================================================
[email protected] [~]# mysqladmin var | grep long_query_time
| long_query_time | 3.000000 |
[email protected] [~]#
=====================================================
Arun
WebhostingDevelopment.com
Post Reply

Return to “my.cnf for mysql”