MySQL Timeout problem ?

Just starting out? Need help? Post your questions and find answers here.
User avatar
skinkairewalker
Enthusiast
Enthusiast
Posts: 635
Joined: Fri Dec 04, 2015 9:26 pm

MySQL Timeout problem ?

Post by skinkairewalker »

hello everyone !

how can I handle the mysql / mariadb timeout efficiently?
* an alternative is to create a thread, and every X milliseconds, it runs a simple query to keep the connection alive, is there another way more efficient?


DriverVersion : MariaDB Connector/C 3.0.9
User avatar
captain_skank
Enthusiast
Enthusiast
Posts: 636
Joined: Fri Oct 06, 2006 3:57 pm
Location: England

Re: MySQL Timeout problem ?

Post by captain_skank »

That's exactly what I did, but I have been using an ODBC connection and the thread runs every 15 minutes.

Seems to work and has been doing so an a daily basis for the last 6 years :)

I don't know if this applies to the built in MySql/MariaDb connectivity though as i'v enot used it for anything usefull yet.
percy_b
User
User
Posts: 72
Joined: Mon Jan 12, 2015 10:25 am

Re: MySQL Timeout problem ?

Post by percy_b »

Hi skinkairewalker,

You might want to consider solving the problem at the database level. If you are the owner of the database, you can change the session timeout yourself. Otherwise, you can ask the database administrator to change it for you.

In either case, you can find the amount of time allocated to your session by running this command in a MySQL client:

Code: Select all

show variables like '%timeout';
Then, pay attention to the "wait timeout", "interactive timeout", "net read timeout" and "net write timeout". But, pay special attention to "wait timeout", which is usually set to about 8 hours.

Here are a couple of useful resources to review:

https://dba.stackexchange.com/questions ... ns-running

https://confluence.atlassian.com/stashk ... 76189.html
Post Reply