特定数据库或用户的mysql一般查询日志? [英] mysql general query log for a specific database or user?

查看:70
本文介绍了特定数据库或用户的mysql一般查询日志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法只记录对某个用户或数据库的查询?我知道您可以设置常规日志,但我不想记录整个 MySQL 实例中的所有查询.相反,我只想记录针对特定数据库的查询.

Is there a way to just log queries for a certain user or database? I know you can set the general log, but I don't want to log all queries across the entire MySQL instance. Rather I would like to only log queries against a specific database.

SET GLOBAL general_log = 'ON';

是否有可以设置的非 GLOBAL 参数?

Is there a non GLOBAL parameter that can be set?

推荐答案

在 MySQL 中没有办法做到这一点,但是您可以 grep 特定数据库的通用日志文件.如果您打算使用 pt-query-digest 您也可以过滤所选数据库的查询.

There is no way to do it in MySQL, but you can grep general log file for specific database. If you are going to use pt-query-digest you can filter queries for selected database as well.

这篇关于特定数据库或用户的mysql一般查询日志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆