【基础知识思考整理】MySQL数据库中的超时值timeout
来源:互联网 发布:sql sp password 编辑:程序博客网 时间:2024/06/16 02:33
基础知识思考整理
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数据库中的超时值timeout
- 【基础知识思考整理 】Mysql高效率的分页查询
- mysql数据库的timeout设置
- 数据库基础知识整理
- 数据库基础知识整理:
- 数据库基础知识整理
- 数据库索引基础知识整理
- MySQL 基础知识整理
- MySQL面试基础知识整理
- mysql 基础知识整理
- excel中的数据整理到mysql数据库
- MySQL数据库中的日期相关函数整理
- 如何修改镜像镜像连接超时值mirroring_connection_timeout
- C#基础知识整理:基础知识(12) 超类Object
- mysql timeout
- Mysql数据库基础知识
- Mysql数据库的基础知识。
- mysql数据库的基础知识
- 20160717常规赛总结
- CenterOS6.5(Minimal) 搭建MySQL
- ssh-keygen
- 趣文:程序员的进化史
- SpringMvc整合Quartz实现定时任务项目源码
- 【基础知识思考整理】MySQL数据库中的超时值timeout
- HDU 1285 确定比赛名次(字典序最小的拓扑排序)
- STM32时钟配置方法详解
- Java程序的编译运行
- Could not get lock /var/lib/dpkg/lock - open 解决方法
- 通天塔导游:各种编程语言的优缺点
- 使用JAXB实现JAVA对象和XML字符串的互相转换
- Spring IOC 自定义属性编辑器PropertyEditor
- Java求字符串中出现次数最多的字符