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 inset(0.01 sec)
mysql>