1、interactive_timeout针对交互式连接,wait_timeout针对非交互式连接。所谓的交互式连接,即在mysql_real_connect()函数中使用了CLIENT_INTERACTIVE选项。

说得直白一点,通过mysql客户端连接数据库是交互式连接,通过jdbc连接数据库是非交互式连接。
interactive_timeout:交互式连接超时时间(mysql工具、mysqldump等)
wait_timeout:非交互式连接超时时间,默认的连接mysql api程序,jdbc连接数据库等

2、如何设置和查看:

mysql> show global variables like 'wait_timeout'; 

mysql> show global variables like 'interactive_timeout';
mysql> set global interactive_timeout=1800;
mysql> set global wait_timeout=1800;

 

 

 

Logo

更多推荐