# MySQL question, of time out variables and connections.

**URL:** https://boards.straightdope.com/t/mysql-question-of-time-out-variables-and-connections/277141
**Category:** Factual Questions
**Created:** [November 29, 2004, 1:45pm UTC](https://boards.straightdope.com/t/mysql-question-of-time-out-variables-and-connections/277141 "2004-11-29T13:45:57Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Bruce\_Daddy](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@Bruce\_Daddy](https://boards.straightdope.com/u/Bruce_Daddy)
#### Post date: [November 29, 2004, 1:45pm UTC](https://boards.straightdope.com/t/mysql-question-of-time-out-variables-and-connections/277141/1 "2004-11-29T13:45:57Z")

</div>

I’m having a hard time understanding how these variables work. If I set max\_connections at 100 and click the run query button in MySQL Control Center (something simple like Select \* from Customers) 101 times I get “Too many connections”. But if I set wait\_timeout to 30, run the query then wait 35 seconds and run it again, I get “Lost connection to MySQL database”. So which is it? Am I getting a new connection each time I go to the database or is it trying to use the same connection each time? To me, it appears to try the one that will fail 🙂

Help?

---

<div class="post-metadata">

### Author: ![ZipperJJ](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/zipperjj/32/211_2.png) [@ZipperJJ](https://boards.straightdope.com/u/ZipperJJ)
#### Post date: [November 29, 2004, 5:32pm UTC](https://boards.straightdope.com/t/mysql-question-of-time-out-variables-and-connections/277141/2 "2004-11-29T17:32:49Z")

</div>

You did remember to [close your connection](http://www.weberdev.com/ViewArticle-11.html) right?

---

<div class="post-metadata">

### Author: ![Bruce\_Daddy](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@Bruce\_Daddy](https://boards.straightdope.com/u/Bruce_Daddy)
#### Post date: [November 29, 2004, 5:59pm UTC](https://boards.straightdope.com/t/mysql-question-of-time-out-variables-and-connections/277141/3 "2004-11-29T17:59:43Z")

</div>

Forget the code, this is just running simple queries from Control Center.

But to answer your question, yes, in the code I am closing them when I am done 🙂

---

<div class="post-metadata">

### Author: ![Punoqllads](https://avatars.discourse-cdn.com/v4/letter/p/d2c977/32.png) [@Punoqllads](https://boards.straightdope.com/u/Punoqllads)
#### Post date: [November 29, 2004, 6:54pm UTC](https://boards.straightdope.com/t/mysql-question-of-time-out-variables-and-connections/277141/4 "2004-11-29T18:54:46Z")

</div>

This is just a guess, but it’s possible that the control center does some sort of handshake after the query, and doing another query too quickly will spawn off another thread to handle that one, consequently opening a new connection. Try doing 100 queries, waiting 20 seconds, and then doing another query.
