7

Need some help. I've looked around topics here on stack and on mysql's website and none of the configurations ever work for me. I need to enable the MySQL slow query log as well as teh general query log. I want to do it in my config file rather than as a SET statement because I assume that would reset whenever mysql was rebooted?

What am I missing?! Every site says something completely different... I'm using MySQL 5.5.15. This is my current config:

[mysqld]
local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
skip-external-locking

query_cache_limit=8M
query_cache_size=64M
query_cache_type=1

long_query_time=2
slow_query_log_file=/var/log/mysqld.slow.log

max_connections=100
max_user_connections=10
interactive_timeout=20
wait_timeout=20
connect_timeout=6

thread_cache_size=128
key_buffer=16M
key_buffer_size=256M

join_buffer=1M
max_allowed_packet=16M
table_cache=1024
read_buffer_size=2M
sort_buffer_size=2M
max_connect_errors=10

# Try number of CPU's*2 for thread_concurrency
thread_concurrency=4
myisam_sort_buffer_size=64M

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
6

Add slow_query_log=1 to your config file.

Reference

| improve this answer | |
  • GENIUS! For some reason when I tried using that before mysql failed to start up again >_<... Do you know how to turn the general query log on as well and specify the file? – Benno Sep 9 '11 at 0:09
  • general_log=1 and general_log_file=/var/log/mysqld.general.log – Christopher Armstrong Sep 9 '11 at 0:18
  • why 1? is that milliseconds? why not 5 or 10? – Rick Sep 23 '13 at 18:07
  • @Rick - it's just a boolean on or off. Valid values are 0 or 1. – Christopher Armstrong May 7 '14 at 7:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.