HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Installation/Configuration (http://www.howtoforge.com/forums/forumdisplay.php?f=27)
-   -   MySQL query limit per hour with database user creation (http://www.howtoforge.com/forums/showthread.php?t=60224)

czdavid 15th January 2013 12:26

MySQL query limit per hour with database user creation
 
Hello,

I need set MySQL query limit per hour and max_user_connections with creation MySQL user by ISPCONFIG. Is it possible?

Thank you!!!

till 15th January 2013 12:33

This should be possible but you will have to change the code of the mysql plugin that creates the user to set these additional parameters.

czdavid 15th January 2013 12:35

Quote:

Originally Posted by till (Post 290743)
This should be possible but you will have to change the code of the mysql plugin that creates the user to set these additional parameters.

Thank you! Where I can find part of code which I have to change?

till 15th January 2013 13:50

The plugins are in /usr/local/ispconfig/server/plugins-available/ There ist just one plugin with mysql in its name.

czdavid 15th January 2013 13:54

Quote:

Originally Posted by till (Post 290748)
The plugins are in /usr/local/ispconfig/server/plugins-available/ There ist just one plugin with mysql in its name.

Thank you Till. You are very helpful :)

czdavid 15th January 2013 23:58

Till can you check if is it right, please?
Im not sure, if it is right place in source.

I use $usage_limit variable for define mysql limits.
$usage_limit variable is put two lines down bellow is defined.

Code:

          // Create the database user if database is active
                        if($data['new']['active'] == 'y') {
                               
                                if($data['new']['remote_access'] == 'y') {
          $this->process_host_list('GRANT', $data['new']['database_name'], $data['new']['database_user'], $data['new']['database_password'], $data['new']['remote_ips'], $link);
                                }
                                $usage_limit = 'WITH MAX_QUERIES_PER_HOUR 100000 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 10';
                                $db_host = 'localhost';
                                mysql_query("GRANT ALL ON `".str_replace(array('_','%'),array('\\_','\\%'),mysql_real_escape_string($data['new']['database_name'],$link))."`.* TO '".mysql_real_escape_string($data['new']['database_user'],$link)."'@'$db_host' IDENTIFIED BY PASSWORD '".mysql_real_escape_string($data['new']['database_password'],$link)."' ".$usage_limit.";",$link);

                               
                        }



All times are GMT +2. The time now is 15:36.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.