alexanoid
alexanoid

Reputation: 25802

How to log mysql slow queries for specific database

My sql instance has a few different databases.

I have configured my.cnf to log slow queries with the following lines:

log_error=/var/log/mysql/error.log
log_queries_not_using_indexes=1
slow_query_log=1
slow_query_log_file=/var/log/mysql/mysql-slow.log
long_query_time=1

It works fine, but I'd like to have logs only for the specific database.

Is it possible ?

Upvotes: 4

Views: 4085

Answers (2)

mohammad inanloo
mohammad inanloo

Reputation: 160

you can use mysql slow log in file then use this command for find slow log row of specific database:

cat  /var/lib/mysql/slow.log |grep -A 3 {your_db_name}

Upvotes: 2

Bittrance
Bittrance

Reputation: 2260

The slow queries log is a global parameter.

http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_slow_query_log

Upvotes: 2

Related Questions