Linux MySQL5.7等保问题整改:数据库未配置登录失败处理功能,未配置非法登录策略和登录超时自动退出功能。

13 篇文章 0 订阅
5 篇文章 0 订阅

Linux MySQL5.7等保问题整改

问题:数据库未配置登录失败处理功能,未配置非法登录策略和登录超时自动退出功能

整改建议:建议数据库设置登录失败处理功能参数,至少满足登录失败次数超过5次采取非法登录锁定措施,登录远超时时间不大于10分钟,如安装CONNECTION_CONTROL和CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS插件,可在命令行中输入。

install plugin CONNECTION_CONTROL soname 'connection_control.so';
INSTALL PLUGIN CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS SONAME 'connection_control.so';

一、Linux登录MySQL数据库并查看是否开启登录失败和超时功能参数

mysql -u root -p

mysql> show variables like '%connection_control%';
Empty set (0.00 sec)

mysql> install plugin CONNECTION_CONTROL soname 'connection_control.so';
Query OK, 0 rows affected (0.16 sec)

mysql> install plugin CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS soname 'connection_control.so';
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
[root@localhost ~]# 

在这里插入图片描述

二、修改配置文件my.cnf


vim /etc/my.cnf

#英文状态下输入:i 进入编辑模式

[mysqld]
connection-control-failed-connections-threshold=5 
connection-control-min-connection-delay=300000

# 按ESC键  输入:wq 保存退出

在这里插入图片描述

三、重启MySQL服务,查看是否生效

# 重启MySQL服务
systemctl restart mysqld.service

# 登录MySQL
mysql -uroot -p

# 查看
show variables like '%connection_control%';

[root@localhost ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.36-log MySQL Community Server (GPL)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

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.

mysql>  show variables like '%connection_control%';
+-------------------------------------------------+------------+
| Variable_name                                   | Value      |
+-------------------------------------------------+------------+
| connection_control_failed_connections_threshold | 5          |
| connection_control_max_connection_delay         | 2147483647 |
| connection_control_min_connection_delay         | 300000     |
+-------------------------------------------------+------------+
3 rows in set (0.01 sec)

mysql> 

在这里插入图片描述

四、完成

  • 5
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值