How to Permanently Modify wait_timeout and max_execution_time in TiDB Configuration File

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tidb在配置文件里如何永久修改wait_timeout 和 max_execution_time

| username: Jolyne

[TiDB Usage Environment] Production Environment / Testing / PoC
Production Environment
[TiDB Version]
5.21
[Reproduction Path] What operations were performed that caused the issue
[Encountered Issue: Problem Phenomenon and Impact]
Currently, there are large SQL queries in the data warehouse that take a long time to execute. However, it is found that if the execution time exceeds 5 minutes, it will automatically disconnect. Although using set global takes effect, sometimes the cluster nodes restart, causing it to become invalid again. I want to permanently modify it in the configuration file. But according to the official documentation, in versions before 5.4, max_execution_time defaults to 0, which does not limit the execution time.
[Resource Configuration]
[Attachments: Screenshots / Logs / Monitoring]

| username: Kongdom | Original post link

Is the disconnection causing the statement to not execute, or is the statement executing but the application layer is receiving an error? You can also analyze it from the application layer’s timeout perspective, for example, if it doesn’t get a response from the database within 5 minutes, it reports an error.

| username: Jolyne | Original post link

The statement stopped executing.

| username: Kongdom | Original post link

:sweat_smile: If the parameters are useful and it is known that version 5.4 can meet the requirements, it is recommended to upgrade to version 5.4.

| username: Jolyne | Original post link

For versions below 5.4, can it be changed in the configuration file, or can it only be changed using set?

| username: Kongdom | Original post link

It probably won’t work. You can try setting it at the beginning of the statement.

| username: WalterWj | Original post link

Adjust the JDBC connection configuration and session-level settings.

| username: 胡杨树旁 | Original post link

The configuration file does not show it, but using show variables like '%max_execution_time%' does return this parameter.