windows下的mysql安装connection_control

发布时间 2023-10-26 16:45:53作者: slnngk

环境:
OS:Windows 2012
mysql:5.7.29

 

1.root账号登录mysql
mysql>mysql -h localhost -uroot -pmysql -P13306
mysql>install plugin connection_control soname 'connection_control.dll';
mysql>install plugin connection_control_failed_login_attempts soname 'connection_control.dll';

文件存储在D:\mysql57\lib\plugin目录下

 

2.查看
mysql> select plugin_name, plugin_status from information_schema.plugins where p
lugin_name like 'connection%';
+------------------------------------------+---------------+
| plugin_name | plugin_status |
+------------------------------------------+---------------+
| CONNECTION_CONTROL | ACTIVE |
| CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS | ACTIVE |
+------------------------------------------+---------------+
2 rows in set (0.00 sec)

 

3.查看各变量
show variables like '%connection_control_failed_connections_threshold%';
show variables like '%connection_control_min_connection_delay%';
show variables like '%connection_control_max_connection_delay%';

 

4.安装要求设置
mysql> SET GLOBAL connection_control_failed_connections_threshold = 3; ##s失败尝试的次数,默认为3,表示当连接失败3次后启用连接控制,0表示不开启
mysql> SET GLOBAL connection_control_min_connection_delay = 1000; ##响应延迟的最小时间,默认 1000 微秒,1秒 表示等待时间,单位是毫秒,这里是1秒,若锁15分钟,则设置为9000000
mysql> SET GLOBAL connection_control_max_connection_delay = 2147483647; ##响应延迟的最大时间,默认约25天

这样设置重启会失效,可以将这些配置写入到my.cnf文件
connection_control_failed_connections_threshold = 3
connection_control_min_connection_delay = 1000
connection_control_max_connection_delay = 2147483647