Hi,
Is it possible for me to turn on audit logging on my mysql database?
I basically want to monitor all queries for an hour, and dump the log to a file.
Hi,
Is it possible for me to turn on audit logging on my mysql database?
I basically want to monitor all queries for an hour, and dump the log to a file.
Start mysql with the --log option:
mysqld --log=log_file_name
or place the following in your my.cnf file:
log = log_file_name
Either one will log all queries to log_file_name.
You can also log only slow queries using the --log-slow-queries
option instead of --log
. By default, queries that take 10 seconds or longer are considered slow, you can change this by setting long_query_time
to the number of seconds a query must take to execute before being logged.
You should be aware that mysql logging on really impacts performance, but it can be a wise thing to do.
I usually leave it on on the dev server (except when it drives us insane :))
Can one change logging while server is running? Or I need to restart server when I want to switch logging on or off?