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(Util.java:406)
	at com.mysql.jdbc.Util.getInstance(Util.java:381)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3536)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3468)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1957)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2107)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648)
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2086)
	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2371)
	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2289)
	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2274)
	... 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

Solution

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?

mkyong

Founder of Mkyong.com, passionate Java and open-source technologies. If you enjoy my tutorials, consider making a donation to these charities.

1 Comment
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Loc Nguyen
13 years ago

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

Connection.open()
loop 5000 execute query
end loop
connection.close

to avoid this issue, you could try:

loop 5000
connection.open()
execute queries
connection.close
endloop()

Thanks
Loc