Is there any way of viewing an account's remaining resources that are allocated to it? I setup an account that's allowed 7200 queries an hour. At any point, could I then run a query to find out how many remaining queries it's allowed?

MySQL must be storing this information somewhere as FLUSH USER_RESOURCES; will reset the counters however, I tried a few variants such as SHOW USER_RESOURCES and they don't seem to display anything. I've also hunted around information_schema and mysql tables.

Is it just not possible to retrieve that information?


User resources are store in "mysql.user" table :

SELECT max_questions, 
FROM   mysql.user 
WHERE  user = 'myuser'
AND    host = '%';


| improve this answer | |
  • Sadly, on a shared server, the information might not be available (SELECT command denied to user). – Fabien Snauwaert Sep 28 '18 at 16:47

To get exact data, you may try enabling log (legacy as general-log). And rotate the log file every one hr. Develop a shell script to get the lines matching for your query and subtract it with 7200 returning value stays as your remaining queries. (NOTE: Ensure log file size shouldn't reduce server cpu much).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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