【基础知识思考整理】MySQL数据库中的超时值timeout
2016-07-17 18:29
633 查看
基础知识思考整理
http://blog.csdn.net/aganlengzi/article/details/51933601
解释:在获取链接时,等待握手的超时时间,只在登录时有效,登录成功这个参数就不管事了。主要是为了防止网络不佳时应用重连导致连接数涨太快,一般默认即可。
interactive_timeout 需在mysql_connect()设置CLIENT_INTERACTIVE选项后起作用,并被赋值为wait_timeout,如果要启用,记得在调用连接函数的时候加上这个属性参数。
添加类似wait_timeout=xxxx的语句即可
通过命令行进行修改
Mysql> set global wait_timeout=xxxx;
http://blog.csdn.net/aganlengzi/article/details/51933601
数据库中关于超时时间的值:
Connect_timeout:
The number of seconds that the mysqld server waits for a connect packet before respondingwith Bad handshake. The default value is 10 seconds as of MySQL 5.1.23 and 5 seconds before that. Increasing the connect_timeout value might help if clients frequently encounter errors of the form Lost connection to MySQL server at ‘XXX’, system error: errno.解释:在获取链接时,等待握手的超时时间,只在登录时有效,登录成功这个参数就不管事了。主要是为了防止网络不佳时应用重连导致连接数涨太快,一般默认即可。
interactive_timeout:
The number of seconds the server waits for activity on an interactive connection before closing it. An interactive client is defined as a client that uses the CLIENT_INTERACTIVE option to mysql_real_connect(). See also wait_timeout.interactive_timeout 需在mysql_connect()设置CLIENT_INTERACTIVE选项后起作用,并被赋值为wait_timeout,如果要启用,记得在调用连接函数的时候加上这个属性参数。
Wait_timeout:
一个连接connection空闲超过8个小时(默认值28800秒),MySQL就会自动断开这个连接。Wait_timeout值可以设定,但是最大是1-2147483(Windows),1-31536000(linux)。我们mini项目中因为超时值问题出想过一次down机,但是后台的脚本自动将进程又拉起来了,所以没有出现功能上的问题。修改方法:
在配置文件mysql.ini中进行设置添加类似wait_timeout=xxxx的语句即可
通过命令行进行修改
Mysql> set global wait_timeout=xxxx;
相关文章推荐
- MySQL中的integer 数据类型
- MySQL存储过程
- Android之获取手机上的图片和视频缩略图thumbnails
- mysql中int、bigint、smallint 和 tinyint的区别与长度
- mysql load data 导出、导入 csv
- source命令执行SQL脚本文件
- MySQL创建用户及权限控制
- MySQL管理数据表
- linux下mysql添加用户
- mysql procedure
- mysql触发器
- 数据库链接字符串查询网站
- MySQL 备份和恢复策略
- mac下安装mysql(转载)
- mysql 修改编码 Linux/Mac/Unix/通用(杜绝修改后无法启动的情况!)
- MySQL数据的导出、导入(mysql内部命令:mysqldump、mysql)
- mysql数据行转列
- Linux下修改MySQL编码的方法