zoukankan      html  css  js  c++  java
  • Linux下mysql修改连接超时(windows下也适用)

    首先进入mysql,查看 wait_timeout、interactive_timeout这个值是否为默认的8小时(即 28800) 
    [root@server110 ~]# mysql -u root -p 
    Enter password: 
    输密码进入 
    执行如下命令 
    show variables like '%timeout%'; 
    +----------------------------+-------+ 
    | Variable_name              | Value | 
    +----------------------------+-------+ 
    | connect_timeout            | 10    | 
    | delayed_insert_timeout     | 300   | 
    | innodb_lock_wait_timeout   | 50    | 
    | innodb_rollback_on_timeout | OFF   | 
    | interactive_timeout        | 28800 | 
    | net_read_timeout           | 30    | 
    | net_write_timeout          | 60    | 
    | slave_net_timeout          | 3600  | 
    | table_lock_wait_timeout    | 50    | 
    | wait_timeout               | 28800 | 
    +----------------------------+-------+ 
    如下表所示,说明连接超时时间使用的是默认的8小时 
    修改之 
    2.在mysql 5以上的版本需要修改my.cnf这个文件,这个文件的位置在 
    /etc/my.cnf 
    在[mysqld]后面加上如下两句话 
    wait_timeout=388000 
    interactive_timeout=388000 
    3.下面重启下mysql 
    service mysqld restart 
    显示如下内容 
    停止 MySQL:                                               [确定] 
    启动 MySQL:                                               [确定] 
    现在你可以在用1的方法,查看下这两个参数的值 
    +----------------------------+--------+ 
    | Variable_name              | Value  | 
    +----------------------------+--------+ 
    | connect_timeout            | 10     | 
    | delayed_insert_timeout     | 300    | 
    | innodb_lock_wait_timeout   | 50     | 
    | innodb_rollback_on_timeout | OFF    | 
    | interactive_timeout        | 388000 | 
    | net_read_timeout           | 30     | 
    | net_write_timeout          | 60     | 
    | slave_net_timeout          | 3600   | 
    | table_lock_wait_timeout    | 50     | 
    | wait_timeout               | 388000 | 
    +----------------------------+--------+ 
    OK,修改好了 
     
    引用地址:http://www.2cto.com/database/201304/206742.html
  • 相关阅读:
    火焰图&perf命令
    C10K问题
    cocosStudio中使用PageView,ListView和ScrollView
    vim基本命令
    Git命令学习总结(-)
    可在 html5 游戏中使用的 js 工具库
    待飞日记(第十一篇)
    待飞日记(第十篇)
    待飞日记(第八天和第九天)
    高质量C++/C编程指南
  • 原文地址:https://www.cnblogs.com/ssh2/p/3473339.html
Copyright © 2011-2022 走看看