I'm getting following error via Microsoft IIS 8' Error Log:

Query execution was interrupted, max_statement_time exceeded

MySQL is 5.7.11-log running on Windows 2012 and per MySQL :: MySQL Server Version Reference :: 1.5 Option/Variable Changes for mysqld 5.7 max_statement_time was introduced in 5.7.4 and removed in 5.7.8, but error still there...

This feature with some changes was ported from Twitter MySQL patches Statement Timeout · twitter/mysql Wiki.

WITHOUT switching to MySQL fork maintained and used at Twitter, what are my other options?

Please advise.


MySQL Bugs: #81071: Query execution was interrupted, max_statement_time exceeded


2 Answers 2


I was experiencing the same issue. Possible to set the global max_execution_time, but not the session max_execution_time:

SET global max_execution_time = 60000;  
SELECT @@global.max_execution_time -- 60000

SET session max_execution_time=300000;
SELECT @@session.max_execution_time -- 15000

I used a hint as workaround:

select /*+ MAX_EXECUTION_TIME(300000) */ * from table
where ...

Source: https://stackoverflow.com/questions/415905/how-to-set-a-maximum-execution-time-for-a-mysql-query


I was having the same problem after upgrading my ODBC Connector from 5.2.7 to 5.3.7, but using MS Access.

I manually added the options

max_execution_time = 0

In my my.ini on server (5.7.10 version) in [mysqld] section. I restarted the server and it worked with the ODBC Connector 5.3.7


Today I executed a query that is longer than 60 seconds and the bug is back. Yesterday my queries were running in less 60 seconds (Before adding max_execution_time = 0 to my.ini, neither were they running).

I executed this command in my PC (ODBC 5.3.07):

show variables like '%max_execution_time%; 


max_execution_time  60000

obs: 60000 = (60 seconds)

I execute a to configure with 5 minutes

SET global max_execution_time = 300000;   
show variables like '%max_execution_time%; 


max_execution_time  60000;

In other machine with ODBC (5.2.7) I execute:

show variables like '%max_execution_time%; 


max_execution_time  300000;

In another test:

SET global max_execution_time = 0;

In my Machine (ODBC 5.3.07);


max_execution_time  60000

In the other Machine (ODBC 5.2.7)


max_execution_time  0;

I think this 5.3 driver is frozen with max_execution_time setting to 60000 (60 seconds)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.