MySQL Error – exceeded the ‘max_questions’ resource (current value: 1000)

While i using my little fancy program to simulate millions of data in MySQL database for volumn testing, my program straight hit the following error after execute few seconds.

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 
User 'mkyong' has exceeded the 'max_questions' resource (current value: 1000)
	at com.mysql.jdbc.Util.handleNewInstance(
	at com.mysql.jdbc.Util.getInstance(
	at com.mysql.jdbc.SQLError.createSQLException(
	at com.mysql.jdbc.SQLError.createSQLException(
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(
	at com.mysql.jdbc.MysqlIO.sendCommand(
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(
	at com.mysql.jdbc.ConnectionImpl.execSQL(
	at com.mysql.jdbc.PreparedStatement.executeInternal(
	at com.mysql.jdbc.PreparedStatement.executeUpdate(
	at com.mysql.jdbc.PreparedStatement.executeUpdate(
	at com.mysql.jdbc.PreparedStatement.executeUpdate(
	... 49 more

This is MySQL feature of monitor the database resources. The “max_questions” means “Number of queries the user can execute within one hour”, obviously my user account only can execute 1000 queries within one hour. I believe this is a very good feature for MySQL in production to stop the resource spamming, but it’s just not a good feature for my volume testing :p


What else? Just turn it off. The following article is showing how to turn it off

How to modify the ‘max_questions’ resource value in MySQL?

author image


Founder of, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities. Read all published posts by


newest oldest most voted
Loc Nguyen
Loc Nguyen

I think this is resource leak error:

you request to much resources in one connection. Such as, in your code, you loop 5000 times to execute queries but you still not close it yet. such as
loop 5000 execute query
end loop

to avoid this issue, you could try:

loop 5000
execute queries