基于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)
标签:control,mysqlx,安全策略,connection,sec,timeout,mysql From: https://www.cnblogs.com/rtnb/p/17465172.html