zoukankan      html  css  js  c++  java
  • MySQL修改connect_timeout(连接超时)全局变量

    telnet 测试数据库的连接超时时间
    telnet 10.5.36.* 3306

    1.登录mysql数据库
    [root@iZbp11rfoyeescusr9ha9qZ conf]# mysql -u root -p

    2.查询匹配“timeout”的全局变量
    MySQL [(none)]> show global 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 | 120 |
    | innodb_rollback_on_timeout | OFF |
    | interactive_timeout | 28800 |
    | lock_wait_timeout | 31536000 |
    | net_read_timeout | 30 |
    | net_write_timeout | 60 |
    | rpl_stop_slave_timeout | 31536000 |
    | slave_net_timeout | 60 |
    | wait_timeout | 28800 |
    +-----------------------------------------+--------------+
    13 rows in set (0.01 sec)

    3.设置全局变量connect_timeout为12小时(12*3600=43200)
    MySQL [(none)]> SET GLOBAL connect_timeout = 43200;
    Query OK, 0 rows affected (0.00 sec)

    4.再次查看,确认参数是否修改成功
    MySQL [(none)]> show global variables like '%timeout%';
    +----------------------------------------+--------------+
    | Variable_name | Value |
    +----------------------------------------+--------------+
    | connect_timeout | 43200 |
    | delayed_insert_timeout | 300 |
    | have_statement_timeout | YES |
    | innodb_flush_log_at_timeout | 1 |
    | innodb_lock_wait_timeout | 120 |
    | innodb_rollback_on_timeout | OFF |
    | interactive_timeout | 28800 |
    | lock_wait_timeout | 31536000 |
    | net_read_timeout | 30 |
    | net_write_timeout | 60 |
    | rpl_stop_slave_timeout | 31536000 |
    | slave_net_timeout | 60 |
    | wait_timeout | 28800 |
    +-----------------------------------------+--------------+
    13 rows in set (0.00 sec)

    5.退出数据库
    MySQL [(none)]> exit
    Bye

  • 相关阅读:
    SQL Server的Execute As与连接池结合使用的测试
    为什么SQL语句Where 1=1 and在SQL Server中不影响性能
    [转]NGINX下配置CACHE-CONTROL
    ls列出当前目录包含子目录下面的所有文件的绝对路径
    [转]无法滚动到溢出容器的Flex项的顶部
    align-items和align-content的区别
    go实现快速排序
    [转]linux超级服务器inetd详解
    makefile 小记
    [转]gcc
  • 原文地址:https://www.cnblogs.com/wangboyu/p/14463680.html
Copyright © 2011-2022 走看看