mysql sql语句执行超时设置

来源:这里教程网 时间:2026-03-01 11:40:00 作者:

mysql 5.6 及以后,有语句执行超时时间变量,用于在服务端对 select 语句进行超时时间限制;  mysql 5.6 中,名为: max_statement_time (毫秒)  mysql 5.7 以后,改成:max_execution_time  (毫秒) 超过这个时间,mysql 就终止 select 语句的执行,客户端抛异常:  1907: Query execution was interrupted, max_execution_time exceeded. 三种设置粒度: (1)全局设置   SET GLOBAL MAX_EXECUTION_TIME=1000;  (2)对某个session设置  SET SESSION MAX_EXECUTION_TIME=1000;   (3)对某个语句设置  SELECT max_execution_time=1000 SLEEP(10), a.* from test a;

相关推荐