===========================================================
使用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
)
::阅读:(68057次)
::
评论
(53)
[回复]
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

Mate1 Dating Site - Holiday Coupon Code - 3 Months FREE!
[回复]
[b]Are You Looking To Meet Someone Over The Holidays?[/b]
[b]Mate1 Dating Site - Holiday Coupon Code - 3 Months Absolutely Free![/b]
Mate1 boasts a membership of over 16 million online daters with a ratio of 50% men and 50% women for the most even playing field on the Internet. It's by far the hottest dating site on the internet right now... You are guaranteed to meet someone you like!
Mate1 is running a special holiday promotion this week - They are giving away 3 months of free access to new members (Men and Women). Absolutely no credit card/payment required.
[b]Instructions on how to get 3 months of free access to Mate1:[/b]
[b]1)[/b]
Go to this link - http://www.gunsntits2.com
[b]2)[/b]
Signup for a free trial account.
During the signup process it will ask you if you want to signup for a 'Free Trial Account' or if you want to 'Subscribe/Pay' - You want to select 揊ree Trial Account
MateOneHolidayOffer
评论于: 2008.12.02 19:26

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

Free Guide On How to Get a Free Adult Friend Finder Gold Membership
[回复]
Free Guide On How to Get a Free Adult Friend Finder Gold Membership
The Ultimate Adult Personals Free Loophole To Gold Membership!!!
This loophole will give you free gold membership to the largest sex and swingers site in the world!
Free easy to use guide on how to use a loophole in Adult Friend Finder to get
a free Adult Friend Finder Gold Membership.
All info to get you on your way is available for free at http://adult-friend-finder-gold-membership.blogspot.com/
Good luck and cya u there 
evewayday
评论于: 2008.12.07 10:50

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

Quick Weight Loss Diets
[回复]
lose weight for the holidays
[url=http://hubpages.com/hub/Strip-That-Fat-Rocks] Quick Weight Loss Diets[/url]
Quick Weight Loss Diets
评论于: 2008.12.24 08:12

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

American Diet News
[回复]
Annually national service of public health services spends, approximately 500 million pounds (about 748 million dollars) on treatment of excess weight. The Lord and lady, do not forget also, that diet pill that work. The diet, is a little sports and diet pill, [url=http://bestdietpill.buypillscheap.com/dietpillthatwork.html]diet pill that work[/url]!
NewsUK
评论于: 2009.01.06 05:23

communicative eschew
[回复]
pen up the communicative satisfied [url=http://clip.nifty.com/entry/0b6090a82b9e481c7924e4a02b1a0db8f21869b2]cialis[/url] sundrye forms as possible. In on the cards, we mirage to assistants disadvantaged communities with foregone connectivity to access persuasible-submited communicative edness, and to espouse
Spooniheigh
评论于: 2009.01.10 10:59

bulk honey shemale horny aunt
[回复]
[url=http://porntube2000.com][COLOR=Red][b][i][u][SIZE=15]>>>CLICK HERE!!! FREE PORN VIDEO FILES>DOWNLOAD FREE SEX VIDEO
AleXXXPirat
评论于: 2009.01.12 21:12

Hello ???????????????????????????????? All. w
[回复]
Hello All. n ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? !!!!!!!!!!!!!!!!!!!! @@@@@@@@@@@@@@@@@@@@@@ qqqqqqqqqqqqqqqqqqqqq
[url=http://karakusas.com]sory[/url]
Alergga
评论于: 2009.01.17 03:28

Best site for You. k ??????????????????????
[回复]
???????????????????????????????????
???????????????????????????????????
?????????????????????????????????????????
????????????????????????????????????????????????
??????????????????????????????
??????????????????????????????
????????????????????????????????????????????
??????????????????????????????????????
[url=http://karakusas.com]leksima[/url]
Miritana
评论于: 2009.01.18 18:12

Hi, new tie here
[回复]
I've found zp21th.itpub.net by using [URL=http://msn.com]MSN[/URL]
Hello!!
my intro
SmoogiasicSiz
评论于: 2009.01.31 18:16