一般查询日志

一般查询日志是用户记录从客户端收到所有 SQL 查询,同时也包括了每一个客户端的链接和断开链接。

如果你希望查看服务器收到的所有 SQL,你可以打开这个日志。

需要注意的是,这个日志文件可能会膨胀得非常快,所以在默认情况下禁用的。

启用一般查询日志

在默认情况下一般查询日志是被系统禁用的。因为这个日志用于记录服务器收到的所有 SQL 查询,这会导致这个文件膨胀得非常快。

如果你值希望查看修改数据的 SQL 查询,你可以使用binary log来替代一般查询日志。

为了启用一般查询日志的功能,请使用--general-log=1这个选项。

选项 log_output服务器状态变量用于决定如何输出这个日志,同时也可以禁用一般查询日志。

如果你希望将一般查询日志写入到文件中,--general_log_file=file_name这个变量决定了需要写入的文件名,默认情况下,文件名为host_name.log,如果你没有为文件指派绝对路径的话,文件所在的目录为数据目录。

不像二进制日志,一般查询日志记录的是服务器接收到的SQL序列,而不是服务器执行SQL 的序列。

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.