Setting mysql to log , general log and slow logs

Isnt it nice to have the mysql log queries for you, say general_logs for general queries action, get some update logs and best of all get the slow queries logged. It is not that hard to get it going for the only thing you need to do is get the my.cnf file modified.

let us do it as below in my.cnf or my.ini file.
# Adding to get the queries logged , not just above 1 second
long_query_time = 0
#path of the file where the slow queries need to be logged
log-slow-queries = path_to_filename

#if path to filename is given a path , mysql logs the log
#as filename in the path or else you could get the logs made
#in the data directory with providing filename instead of path_to_filename

#path where all quereis at mysql are logged
log = path_to_filename or filename

Sometimes , you wont get the my.cnf built or you could have one custom built by modifiying any of the default set came with mysql.
Now it is time and just a soft restart your mysql should get working logging 🙂

Do post comments or queries so that in the process we bring out more things to help each other


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: