To increase the timeout setting for a MySQL connection in a cloud database, you typically need to adjust the wait_timeout and interactive_timeout parameters in the database configuration. These parameters control how long the server waits for activity on a connection before closing it.
wait_timeout and interactive_timeout (default is usually 28800 seconds, or 8 hours).604800 for 7 days) and save the changes.If your application frequently experiences disconnections due to inactivity, increasing wait_timeout to 86400 (24 hours) can help maintain long-lived connections.
In TencentDB for MySQL, you can adjust these parameters via the Console:
wait_timeout and interactive_timeout, modify the values, and apply changes.If you're using a connection pool (e.g., in Java with HikariCP or Python with SQLAlchemy), ensure the pool's idle timeout aligns with the database's wait_timeout to avoid premature disconnections.
For TencentDB, you can also use ProxySQL (if supported) to manage connection timeouts dynamically.