Description
wait_timeout sets the number of seconds that the server waits for activity before closing a noninteractive connection.
Privilege requirements
Query variables
Global level
You can use the
SHOW VARIABLESstatement or query theSYS.TENANT_VIRTUAL_GLOBAL_VARIABLEview (Oracle mode) orinformation_schema.GLOBAL_VARIABLESview (MySQL mode) to view the values of global system variables for thesystenant and user tenants.Session level
In both Oracle and MySQL compatible modes, the
systenant and all user tenants can query session system variables by using theSHOW VARIABLESstatement or views. In Oracle compatible mode, session system variables are displayed in theSYS.TENANT_VIRTUAL_SESSION_VARIABLEview. In MySQL compatible mode, session system variables are displayed in theinformation_schema.SESSION_VARIABLESview.
Modify variables
Global level
You can directly modify the values of Global system variables in the
systenant.MySQL user tenants must have the
SUPERorALTER SYSTEMpermission to modify Global system variable values.For V4.x, from V4.2.0 onward, Oracle user tenants need the
ALTER SYSTEMprivilege to modify the values of Global system variables.
Session level
All tenants, including the
systenant, can directly modify the values of session system variables for their tenants.
Attributes
| Property | Description |
|---|---|
| Parameter Type | Int |
| Default value | 28800, in seconds. |
| Value range | [1, 31536000] |
| Scope |
|
| Modifiable | Yes. You can execute the SET statement to modify the value. |
Description
At the start of the session, the system initializes the value of the wait_timeout session variable based on the value of the global wait_timeout or interactive_timeout variable, depending on the client type. The CLIENT_INTERACTIVE connection option in mysql_real_connect() defines the client type. For more information about the interactive_timeout variable, see interactive_timeout.
Examples
Set the time that the server waits for active connections before closing them to 1800 seconds or 30 minutes.
Session level
obclient> SET wait_timeout =1800;Global level
obclient> SET GLOBAL wait_timeout =1800;
References
If you want to set the number of seconds that the server waits for an interactive connection to become inactive before closing it, see interactive_timeout.