I’ve read the MySQL docs, and questions wasn’t an answer to my question.
visited question 1,
visited question 2 – while connection polling and facing error ,
visited question 3
I’ve set MySQL’s GLOBAL wait_timeout
to 600
seconds, which means it’ll end in 10 minutes. and it was ending in 14 minutes, as I’ve tested; I’ve attached the response error image.
Here is image of setting global wait_timeout
What is happening now? I’ve visited some questions to implement connection polling, where I found some solutions.
but when I performed those solutions, wait_timeout
stopped working. which is becoming my headache. I want wait_timeout
to be ended at the time I’ve set, but it’s not ending. see the picture below the wait_timeout
is not getting updated
4
Answers
I've tried running this command
SHOW GLOBAL VARIABLES;
. It showed me those three variables getting set await_timeout
,mysqlx_interactive_timeout
=> which is parameter is related to MySQL X Protocol, which is a new protocol introduced in MySQL 8.0 for use with MySQL Document Store. It is used to set the timeout for interactive sessions that use the X Protocol. having the same value as wait_timeout=28800mysqlx_wait_timeout
is another parameter that is related to MySQL X Protocol and is used to set the timeout for client connections that use the X Protocol. having the same value as wait_timeout=28800.Note, in particular,
SET GLOBAL
(for nost settings) has no effect on users that are currently logged in. It will be inherited by anyone logging in after that.wait_timeout
is tricky. Interactive/batch, GLOBAL/SESSION/not-yet-relogged-in.Sorry, but I can’t figure out which one to set in which situation.
After Some research I’ve found some information
wait_timeout
is a global variable that sets the timeout for idle client connections. It applies to all client connections, regardless of the protocol used (including X Protocol connections). When a client connection is idle (i.e., not executing any queries) for longer than the specifiedwait_timeout
, the connection is closed by the server.mysqlx_interactive_timeout
is also a global variable that sets the timeout for interactive sessions that use the MySQL X Protocol. It applies only to X Protocol connections and is used to set the maximum duration of an interactive session between the client and the server. An interactive session is defined as a session that has issued at least one statement, but has not issued a statement that requires a longer timeout, such as a long-running query or a transaction. When themysqlx_interactive_timeout
value is exceeded, the session is closed by the server.mysqlx_wait_timeout
is another global variable that sets the timeout for client connections that use the MySQL X Protocol. It applies only to X Protocol connections and is used to set the maximum duration of a client’s wait time for the server to send a response. When themysqlx_wait_timeout
value is exceeded, the client connection is closed by the server.In summary,
wait_timeout
sets the timeout for idle client connections,mysqlx_interactive_timeout
sets the timeout for interactive sessions that use the X Protocol, andmysqlx_wait_timeout
sets the timeout for client connections that use the X Protocol while waiting for a response.Well, after researching more deeper I found my mistake was to not use workbench and knowledge of
wait_timeout
working, so here is what I found.Whenever a global variable has been updated in the current session but not committed, MySQL shows the persistent value rather than the real value (in the terminal). (But one can see it changing in the workbench.)
A workbench image
Mean While in the terminal,
Both in the same time
When one uses the
SET GLOBAL
command to change a global variable, changes are made instantly for the current session but are not saved to the MySQL configuration file. If one ends the session or restarts the MySQL server, the variable’s original value will be utilized.