我将这一行添加到 my.ini
wait_timeout=2000000
当我打字时
show global variables
它打印 wait_timeout=2000000,
但是当我打字的时候
show variables
它打印 wait_timeout=28800
我可以设置
set wait_timeout=2000000
但我不想一直手动设置。
您对设置永久 session 系统变量有什么建议吗?
最佳答案
您可能还需要检查 interactive_timeout 是否已设置 - 常规客户端连接可能会采用您的新设置,但是当您使用交互式客户端手动检查它时,MySQL 将从该设置设置超时:
On thread startup, the session wait_timeout value is initialized from the global wait_timeout value or from the global interactive_timeout value, depending on the type of client (as defined by the CLIENT_INTERACTIVE connect option to mysql_real_connect()). See also interactive_timeout.
关于mysql - 在 MySQL 中永久更改 session 系统变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3649543/