mysql安全策略

基于8.x版本

安装插件

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

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

mysql> show plugins;

设置登录失败次数及锁定时间,这里单位为ms

复制代码
mysql> SET  GLOBAL  connection_control_max_connection_delay=900000;
Query OK, 0 rows affected (0.00 sec)

mysql> SET  GLOBAL  connection_control_min_connection_delay=900000;
Query OK, 0 rows affected (0.00 sec)

mysql> SET  GLOBAL  connection_control_failed_connections_threshold = 3;
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like '%connection_control%';
+-------------------------------------------------+--------+
| Variable_name                                   | Value  |
+-------------------------------------------------+--------+
| connection_control_failed_connections_threshold | 3      |
| connection_control_max_connection_delay         | 900000 |
| connection_control_min_connection_delay         | 900000 |
+-------------------------------------------------+--------+
复制代码

设置空闲自动断开时间为15分钟,这里单位为s

复制代码
mysql> set    interactive_timeout=900;
mysql> set    wait_timeout=900;
mysql> show variables like '%timeout%';
+-----------------------------------+----------+
| Variable_name                     | Value    |
+-----------------------------------+----------+
| connect_timeout                   | 10       |
| delayed_insert_timeout            | 300      |
| have_statement_timeout            | YES      |
| innodb_flush_log_at_timeout       | 1        |
| innodb_lock_wait_timeout          | 50       |
| innodb_rollback_on_timeout        | OFF      |
| interactive_timeout               | 15       |
| lock_wait_timeout                 | 31536000 |
| mysqlx_connect_timeout            | 30       |
| mysqlx_idle_worker_thread_timeout | 60       |
| mysqlx_interactive_timeout        | 28800    |
| mysqlx_port_open_timeout          | 0        |
| mysqlx_read_timeout               | 30       |
| mysqlx_wait_timeout               | 28800    |
| mysqlx_write_timeout              | 60       |
| net_read_timeout                  | 30       |
| net_write_timeout                 | 60       |
| rpl_stop_slave_timeout            | 31536000 |
| slave_net_timeout                 | 60       |
| wait_timeout                      | 15       |
+-----------------------------------+----------+
20 rows in set (0.01 sec)
复制代码

 刷新

FLUSH PRIVILEGES;
posted @   不会跳舞的胖子  阅读(54)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
点击右上角即可分享
微信分享提示