mysql5.7.28 密码、登录失败策略插件安装

修改密码

配置/etc/my.cnf文件
skip-grant-tables
重启服务

service mysqld restart
mysql -uroot -p

直接回车

use mysql;
ALTER USER 'root'@'localhost' identified by 'yourpassword';

查看用户是否有远程连接权限

SELECT User, Host, Authentication_string FROM mysql.user;

在这里插入图片描述
如果没有%则需要赋予远程连接权限

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION; 

如果有%,则直接修改远程密码

ALTER USER 'root'@'%' identified by 'yourpassword';

查看用户状态

select host,user,password_expired,password_last_changed,password_lifetime,account_locked from mysql.user;

显示密码最后修改时间

刷新

flush privileges;
exit

策略插件配置

查看mysql插件位置

show variables like 'plugin_dir';

在这里插入图片描述
要使服务器可用,插件库文件必须位于MySQL插件目录中(由plugin_dir系统变量命名的目录)。如果需要,通过在服务器启动时设置plugin_dir的值来配置插件目录位置。

配置文件修改

vim /etc/my.cnf

#skip-grant-tables
#加载密码策略插件
plugin-load-add=validate_password.so
#加载密码失败策略插件
plugin-load-add=connection_control.so
#密码长度的最小值
validate_password_length=8
#指定了密码中大小字母的最小个数
validate_password_mixed_case_count=1
#指定了密码中数字的最小个数
validate_password_number_count=1
#指定了密码策略的强度
validate_password_policy=MEDIUM
#特殊字符的最小个数。
validate_password_special_char_count=1
#密码过期时间(单位天)
default_password_lifetime=180
#允许密码错误次数5次
connection_control_failed_connections_threshold=5
#密码错误后最小等待时间1分钟(单位毫秒)
connection_control_min_connection_delay=60000
connection_control_failed_connections_threshold=5
#密码错误后最大等待时间(单位毫秒)
connection_control_max_connection_delay=2147483000
#允许因为网络异常导致链接失败的最大次数
max_connect_errors =10
#非交互式连接超时时间(单位秒)
wait_timeout=1200
#交互式连接超时时间(单位秒)
interactive_timeout=1200

重启服务

service mysqld restart

查看插件

show plugins;

在这里插入图片描述

https://www.cnblogs.com/kerrycode/p/8405862.html
http://www.manongjc.com/detail/18-pthznbuiperqlty.html

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值