===========================================================
使用mysql的过程出现数据库连接自动断开的问题
===========================================================
作者: zp21th(http://zp21th.itpub.net)
发表于: 2004.12.03 10:50
分类:
MySQL
出处: http://zp21th.itpub.net/post/1937/8292
---------------------------------------------------------------
近一段时间,很多部门同事反映在使用mysql的过程出现数据库连接自动断开的问题,我对该问题做了一些实验。
关于mysql自动断开的问题研究结果如下,在mysql中有相关参数设定,当数据库连接空闲一定时间后,服务器就
会断开等待超时的连接:
1、相关参数,红色部分
mysql> show variables like '%timeout%';
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| connect_timeout | 5 |
| delayed_insert_timeout | 300 |
| innodb_lock_wait_timeout | 50 |
| interactive_timeout | 28800 |
| net_read_timeout | 30 |
| net_write_timeout | 60 |
| slave_net_timeout | 3600 |
| wait_timeout | 28800 |
+--------------------------+-------+
同一时间,这两个参数只有一个起作用。到底是哪个参数起作用,和用户连接时指定的连接参数相关,缺省情况下是使用
wait_timeout。我建议是将这两个参数都修改,以免引起不必要的麻烦。
2、修改参数
这两个参数的默认值是8小时。我测试过将这两个参数改为0,结果出人意料,系统自动将这个值设置为1。换句话说,不能将该值设置为永久。我建议为参数值加三个0,这样肯定可以满足我们的应用要求。
修改操作:打开/etc/my.cnf,在属性组mysqld下面添加参数如下:
[mysqld]
interactive_timeout=28800000
wait_timeout=28800000
zp21th
发表于:2004.12.03 10:50
::分类:
(
MySQL
)
::阅读:(68620次)
::
评论
(44)
[回复]
Sandra-xp
评论于: 2007.08.26 04:01
[回复]
Vilyamnf
评论于: 2007.09.17 03:00
[回复]
Vilyamhs
评论于: 2007.09.17 03:00
[回复]
Vilyamnf
评论于: 2007.09.17 03:00
[回复]
Vilyamhs
评论于: 2007.09.17 03:00
[回复]
Vilyamhs
评论于: 2007.09.17 03:00
[回复]
Vilyamhs
评论于: 2007.09.17 03:01
[回复]
Vilyamic
评论于: 2007.09.17 03:01
[回复]
Vilyamic
评论于: 2007.09.17 03:01
[回复]
Vilyamic
评论于: 2007.09.17 03:01
[回复]
Vilyamic
评论于: 2007.09.17 03:01
[回复]
Vilyambd
评论于: 2007.09.25 23:24
[回复]
Vilyambd
评论于: 2007.09.25 23:24
[回复]
Vilyamwz
评论于: 2007.09.25 23:25
[回复]
Vilyamwq
评论于: 2007.10.01 17:21
[回复]
Vilyambo
评论于: 2007.10.01 17:22
[回复]
Vilyamwq
评论于: 2007.10.01 17:22
[回复]
Vilyamrh
评论于: 2007.10.01 17:22

[*map/map_all_coml10.txt||10||r||1|| @]
[回复]
[*map/map_all_coml10.txt||10||r||1|| @]
dotarull
评论于: 2007.10.15 12:22
[回复]
Alexkpu
评论于: 2007.11.15 03:38
[回复]
Alexmfr
评论于: 2007.11.15 03:38
[回复]
Alexkpu
评论于: 2007.11.15 03:38
[回复]
Alexmfr
评论于: 2007.11.15 03:39
[回复]
Alexmfr
评论于: 2007.11.15 03:39
[回复]
Alexmxv
评论于: 2007.11.15 03:39
[回复]
Alexmfr
评论于: 2007.11.15 03:39
[回复]
Alexmxv
评论于: 2007.11.15 03:39
[回复]
Alexmfr
评论于: 2007.11.15 03:39
[回复]
Alexmxv
评论于: 2007.11.15 03:39
[回复]
Alexmxv
评论于: 2007.11.15 03:39
[回复]
Sandra-ba
评论于: 2007.11.21 21:41
[回复]
Vilyamwv
评论于: 2007.11.21 21:41
[回复]
Vilyamwv
评论于: 2007.11.21 21:41
[回复]
Alexrse
评论于: 2007.11.21 21:42
[回复]
Oksana-vu
评论于: 2007.11.23 20:44
[回复]
Oksana-hq
评论于: 2007.11.23 20:44
[回复]
Oksana-hq
评论于: 2007.11.23 20:44
[回复]
klira
评论于: 2007.12.13 17:56

re: 使用mysql的过程出现数据库连接自动断开的问题
[回复]
hydroxylated in www.nationalwebmeds.com phentermine diet the liver hydroxylated in phentermine diet the liver hydroxylated in [url=www.nationalwebmeds.com]phentermine diet[/url] the liver hydroxylated in [URL]www.nationalwebmeds.com[/URL] phentermine diet the liver to ?-hydroxyalprazolam, www.myinternetmedications.com phentermine no prescription which is to ?-hydroxyalprazolam, phentermine no prescription which is to ?-hydroxyalprazolam, [url=www.myinternetmedications.com]phentermine no prescription[/url] which is to ?-hydroxyalprazolam, [URL]www.myinternetmedications.com[/URL] phentermine no prescription which is also pharmacologically www.discountmedsplace.com buy phentermine online active. This also pharmacologically buy phentermine online active. This also pharmacologically [url=www.discountmedsplace.com]buy phentermine online[/url] active. This also pharmacologically [URL]www.discountmedsplace.com[/URL] buy phentermine online active. This and other www.onlinemedstoday.com buying viagra metabolites are and other buying viagra metabolites are and other [url=www.onlinemedstoday.com]buying viagra[/url] metabolites are and other [URL]www.onlinemedstoday.com[/URL] buying viagra metabolites are later excreted www.medspointstore.com cheapest viagra in urine later excreted cheapest viagra in urine later excreted [url=www.medspointstore.com]cheapest viagra[/url] in urine later excreted [URL]www.medspointstore.com[/URL] cheapest viagra in urine
Qswefn Qswefnamh
评论于: 2008.06.29 04:34

re: 使用mysql的过程出现数据库连接自动断开的问题
[回复]
Pfizer's product. www.onlinemedscentral.com phentermine cod Viagra is Pfizer's product. phentermine cod Viagra is Pfizer's product. [url=www.onlinemedscentral.com]phentermine cod[/url] Viagra is Pfizer's product. [URL]www.onlinemedscentral.com[/URL] phentermine cod Viagra is also informally www.bestmedsplace.com tramadol ultram known as also informally tramadol ultram known as also informally [url=www.bestmedsplace.com]tramadol ultram[/url] known as also informally [URL]www.bestmedsplace.com[/URL] tramadol ultram known as "Vitamin V", www.bargainmedsplace.com generic phentermine "the Blue "Vitamin V", generic phentermine "the Blue "Vitamin V", [url=www.bargainmedsplace.com]generic phentermine[/url] "the Blue "Vitamin V", [URL]www.bargainmedsplace.com[/URL] generic phentermine "the Blue Pill", as www.medsthrifty.com phentermine no prescription well as Pill", as phentermine no prescription well as Pill", as [url=www.medsthrifty.com]phentermine no prescription[/url] well as Pill", as [URL]www.medsthrifty.com[/URL] phentermine no prescription well as various other www.bestcheapmedsworld.com discount tramadol nicknames.
In February various other discount tramadol nicknames.
In February various other [url=www.bestcheapmedsworld.com]discount tramadol[/url] nicknames.
In February various other [URL]www.bestcheapmedsworld.com[/URL] discount tramadol nicknames.
In February
Teiqgw Teiqgwfic
评论于: 2008.06.29 05:16

If You want to delete your site from my base
[回复]
to: Admin - If You want to delete your site from my spam list, please sent url of your domain to my e-mail: stop.spam.today@gmail.com
And I will remove your site from my base within 24 hours
webmastegz
HelfInvilmive
评论于: 2008.11.17 06:13

independent opinionss
[回复]
How you think when the economic crisis will end? I wish to make statistics of independent opinions!
ooopinionsss
评论于: 2008.12.04 12:22

Just registrered
[回复]
Hi
As newly registered user i just want to say hello to everyone else who uses this forum :-D
ZokTahcheeree
评论于: 2008.12.20 11:40

署囫桠
[回复]
唣铖豚
评论于: 2009.01.04 10:37