Limit mySQL queries to 10 K per hour

online24

New member
Joined
Nov 12, 2009
Messages
4
Hello,

i am junior with DirectAdmin, and i would like to ask - there are any possibility to limit mySQL queries per hour to 10 K (for example) for all existing databases/users and for newly created? I think it is more better then let mySQL use 100% of CPU instead.

Sorry if this thread was exist, i didint find it.
 
Oh, cool, very quickly, Thank you :) By this tutorial, you can limit one by one users but not all immediately :/
 
I dunno if its a phpmyadmin feature or something built into mysql. Would have to do more research...
 
I found you can do it with the GRANT option when setting up users.

MAX_QUERIES_PER_HOUR

http://dev.mysql.com/doc/refman/5.1/en/grant.html

I wonder if its possible to change the sql string that directadmin uses to setup users to add that? You might have to ask directadmin support to change/add that feature.
 
Ok, thank you very much ;)

mysql -uda_admin -pXXX -e "GRANT USAGE ON *.* TO '$USER_DB'@'localhost' WITH MAX_QUERIES_PER_HOUR $MAX_QUERIES;"


USER_DB is the username of DB that you want to limit in queries

If you want to automatically limit all users edit this file:

/usr/local/directadmin/scripts/mysql.sh

by editing mysql queries that DA use to create users.
 
mysql.sh is only used when installing mysql its not called when setting up users...
 
Back
Top