general query log能记录成功连接和每次执行的查询,我们可以将它用作安全布防的一部分,为故障分析或黑客事件后的调查提供依据。
1、查看log配置信息 show variables like '%general%'; 2、开启日志 SET GLOBAL general_log = 'On'; 3、指定日志文件路径 #SET GLOBAL general_log_file = '/var/lib/mysql/mysql.log';
Time Id Command Argument190601 22:03:20 98 Connect root@192.168.204.1 on 98 Connect Access denied for user 'root'@'192.168.204.1' (using password: YES)103 Connect mysql@192.168.204.1 on 103 Connect Access denied for user 'mysql'@'192.168.204.1' (using password: YES)104 Connect mysql@192.168.204.1 on 104 Connect Access denied for user 'mysql'@'192.168.204.1' (using password: YES)100 Connect root@192.168.204.1 on 101 Connect root@192.168.204.1 on 101 Connect Access denied for user 'root'@'192.168.204.1' (using password: YES)99 Connect root@192.168.204.1 on 99 Connect Access denied for user 'root'@'192.168.204.1' (using password: YES)105 Connect mysql@192.168.204.1 on 105 Connect Access denied for user 'mysql'@'192.168.204.1' (using password: YES)100 Query set autocommit=0102 Connect mysql@192.168.204.1 on 102 Connect Access denied for user 'mysql'@'192.168.204.1' (using password: YES)100 Quit `
你知道在这个口令猜解过程中,哪个是成功的吗?
利用爆破工具,一个口令猜解成功的记录是这样子的:
190601 22:03:20 100 Connect root@192.168.204.1 on 100 Query set autocommit=0100 Quit
但是,如果你是用其他方式,可能会有一点点不一样的哦。
Navicat for MySQL登录:
190601 22:14:07 106 Connect root@192.168.204.1 on 106 Query SET NAMES utf8106 Query SHOW VARIABLES LIKE 'lower_case_%'106 Query SHOW VARIABLES LIKE 'profiling'106 Query SHOW DATABASES