是否可以在我的mysql数据库上启用审核日志记录?
我基本上是要监视一个小时的所有查询,并将日志转储到一个文件。
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.
最满意答案
使用--log选项启动mysql:
mysqld --log=log_file_name或将以下内容放在my.cnf文件中:
log = log_file_name任何一个都会将所有查询记录到log_file_name。
您也可以使用--log-slow-queries选项而不是--log来仅记录缓慢查询。 默认情况下,需要10秒或更长时间的查询被认为很慢,您可以通过将long_query_time为在记录之前执行的查询所需的秒数来进行更改。
Start mysql with the --log option:
mysqld --log=log_file_nameor place the following in your my.cnf file:
log = log_file_nameEither 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.
更多推荐
发布评论