CREATE TEMPORARY TABLE `CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS` (
`USERHOST` varchar(162) NOT NULL DEFAULT '',
`FAILED_ATTEMPTS` int(16) unsigned NOT NULL DEFAULT '0'
) ENGINE=MEMORY DEFAULT CHARSET=utf8;
# 先在一台客户端主机上随意输错帐号或者密码连续4次,你会发现第四次开始连接被延迟了
[root@localhost ~]# time mysql -uadmin -pletsg
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password: YES)
real 0m0.014s
user 0m0.010s
sys 0m0.003s
[root@localhost ~]# time mysql -uadmin -pletsg
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password: YES)
real 0m0.013s
user 0m0.010s
sys 0m0.002s
[root@localhost ~]# time mysql -uadmin -pletsg
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password: YES)
real 0m0.012s
user 0m0.008s
sys 0m0.003s
[root@localhost ~]# time mysql -uadmin -pletsg
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password: YES)
real 0m1.013s
user 0m0.005s
sys 0m0.007s
# 此时,查看表中的记录内容
root@localhost : information_schema 12:47:01> select * from CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS;
+-------------+-----------------+
| USERHOST | FAILED_ATTEMPTS |
+-------------+-----------------+
| 'admin'@'%' | 4 |
+-------------+-----------------+
1 row in set (0.00 sec)
# 输入正确的帐号和密码
[root@localhost ~]# time mysql -uadmin -pletsg0
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 20
Server version: 5.7.20-enterprise-commercial-advanced-log MySQL Enterprise Server - Advanced Edition (Commercial)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
admin@localhost : (none) 12:48:04>
# 再次查看表内容,发现记录被删除了
root@localhost : information_schema 12:47:45> select * from CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS;
Empty set (0.00 sec)