千家信息网

mysql会话控制限制登录次数(connection_control插件)

发表于:2025-11-12 作者:千家信息网编辑
千家信息网最后更新 2025年11月12日,数据库环境:Server version: 5.6.41 MySQL Community Server (GPL)1、查看用户mysql> select Host,User from user whe
千家信息网最后更新 2025年11月12日mysql会话控制限制登录次数(connection_control插件)

数据库环境:

Server version: 5.6.41 MySQL Community Server (GPL)


1、查看用户

mysql> select Host,User from user where User='jiangjj';

2、安装插件

安装方式1:

mysql> Install plugin connection_control soname "connection_control.so";

mysql> show plugins;

安装方式2:

# vim /etc/my.cnf

[mysqld]

#添加如下参数

plugin-load=CONNECTION_CONTROL=connection_control.so

connection_control_min_connection_delay=60000

重启即可

3、查看相关配置,进行调整

连续失败次数3和超过失败连接上限后的最小延迟登录时间为1分;

mysql> show variables like "%connection_control%";

4、测试:如果三次登录验证失败,将等待1分钟,如图

5、卸载:

mysql> uninstall plugin CONNECTION_CONTROL;

6、总结

连续失败登录控制是生效,避免了大量的、非法连接×××的可能性,为了增加安全系数,可增加最小延迟时间。


0