mysql中的命令是什么,我可以实现中止连接和拒绝访问的日志写入系统日志?
答案 0 :(得分:2)
这些命令首先要查看您的设置:
select @@general_log; -- a 1 indicates it is turned on for capture
select @@general_log_file; -- the file that it logs to
select @@datadir; -- directory location where the log lives
要开启General Query Log的登录,请使用以下命令:
SET GLOBAL general_log = 'ON'; -- 0 is off, 1 is on
请注意,datadir
是只读的,需要在更改后重新启动服务器。基本上,不要改变这一点。它是数据库模式的主页。
对于扩展连接失败,请执行
select @@log_warnings; -- make a note of your prior setting
set global log_warnings=2; -- setting above 1 increases output
上面的内容与在同一datadir中写出的错误日志有关。
请参阅Percona文章Auditing login attempts in MySQL和我之前的回答Here。