There are always some Web site users on the server is too large, and affect the normal use of other sites, then how to put a certain smelly fish in their own acres of three points? Methods to limit the maximum number of connections for a single user in a MySQL database I'll take a look at the methods and principles below:
1, for Linux and Uinx operating system need to find MY.CNF, for Windows operating system need to find My.ini
2, because my file is a MySQL configuration file, we previously only know that he is the overall control of the MySQL database, in fact, he can also restrict the individual users.
3, the my.cnf or My.ini download down, edit, you can remove the superfluous items, add:
Max_connections = 10//Indicates that the user is limited to the maximum number of connections 10, but do not upload the wrong place Oh! Methods to limit the maximum number of connections per user for a MySQL database
Of course, for other projects can also be added below, such as the number of concurrent, buffering, etc., Play it yourself!
4. Upload your modified file to the user's MySQL directory, for example, you built a database called ABC, you put him under ABC.
So the operation can make smelly fish rotten in their own pot, haha haha ha! How to limit the maximum number of connections for a single user in a MySQL database it's genius.
However, there is an easier way to enter a command:
Mysql-u root-p
Input: GRANT all on customer.* to ' database name ' @ ' localhost '
Input: Identified by ' database name '
Input: With max_user_connections 4 (limit maximum number of connections)
Input: Max_connections_per_hour 1000; (Limit the maximum number of connections per hour)
You can also enter directly: GRANT all on customer.* to ' database name ' @ ' localhost ' with max_user_connections 4 Max_connections_per_hour 1000;
Then restart MySQL!
GRANT all on Dcrosdata (database name). * to ' dcrosdata_f (user name) ' @ '% ' with max_user_connections Max_connections_per_hour 1000;
Methods to limit the maximum number of connections per user for a MySQL database