MySQL 5.7 以后提供了Connection-Control插件用来控制客户端在登录操作连续失败一定次数后的响应的延迟。 该插件可有效的防止客户端暴力登录的风险(攻击)。该插件包含以下两个组件: connection_control:控制失败次数以及延迟时间 connection_control_failed_login_attempts:将登录失败的操作记录至information_schema表 my.cnf添加以下配置 [mysqld]plugin-load-add =connection_control.so connection-control =FORCE connection-control-failed-login-attempts =FORCE connection_control_min_connection_delay = 1000connection_control_max_connection_delay = 86400connection_control_failed_connections_threshold = 5 执行安装命令,使用root账户登录 mysql>install plugin connection_control soname "connection_control.so"; mysql>install plugin connection_control_failed_login_attempts soname "connection_control.so"; 验证插件安装状态 mysql> select plugin_name, plugin_status from information_schema.plugins where plugin_name like 'connection%'; +------------------------------------------+---------------+ | plugin_name | plugin_status | +------------------------------------------+---------------+ | CONNECTION_CONTROL | ACTIVE | | CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS | ACTIVE | +------------------------------------------+---------------+ 2 rows in set (0.00sec) 查看用户登录失败次数,当用户登录成功则删除记录 mysql> select * frominformation_schema.connection_control_failed_login_attempts; 连接控制的使用次数 mysql> show global status like 'connection_control_delay_generated'; 超过失败次数如果想要马上登录,需要设置一下即可。 mysql> set global connection_control_failed_connections_threshold=0; 成功后别忘了改回来 mysql> set global connection_control_failed_connections_threshold=5;
MySQL会话控制限制登录次数
免责声明:文章转载自《MySQL会话控制限制登录次数》仅用于学习参考。如对内容有疑问,请及时联系本站处理。
上篇Windows Server 2012 AD域管理创建MySQL行列转换下篇
宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=