MySQL user connection limit

giorgi91

Verified User
Joined
Oct 22, 2011
Messages
19
Hello,

I need help please.

I want to make limit for each mysql user, is it possible? and if it is possible, who can I make it?
Now my one user can request unlimited connections, so server has problem.
I need limit for each user.

Example: user1_db I want to make connect only 20 connect.
also I want user2_db make 20 only connect per second. and etc..

I'm see "show processlist" and I have many sleep connects, I want to close all sleep connect in 20 second.
I'm add this on my.cnf
wait_timeout=15
connect_timeout=10
interactive-timeout = 30
max_user_connections=20
and I'm restart mysqld, but it does not work.

show proccesslist:
218 localhost user1_db Sleep 766
3103 localhost user1_db Sleep 12
4107 localhost user1_db Sleep 374
5304 localhost user1_db Sleep 27
5314 localhost user1_db Sleep 56
5397 localhost user1_db Sleep 222
5486 localhost user1_db Sleep 196
5697 localhost user1_db Sleep 190
5845 localhost user1_db Sleep 174
6078 localhost user1_db Sleep 151
6100 localhost user1_db Sleep 151
6336 localhost user1_db Sleep 131
6338 localhost user1_db Sleep 130
6396 localhost user1_db Sleep 126
6400 localhost user1_db Sleep 126
6409 localhost user1_db Sleep 125
6464 localhost user1_db Sleep 119
6472 localhost user1_db Sleep 118
6637 localhost user1_db Sleep 99
6743 localhost user1_db Sleep 87
6950 localhost user1_db Sleep 62
7049 localhost user1_db Sleep 49
7247 localhost user1_db Sleep 26
7297 localhost user1_db Sleep 22
7334 localhost user1_db Sleep 17
7464 localhost user1_db Sleep 3
7489 localhost user2_db Query 0
7490 localhost Processlist 0
What can I do?

Thank you
 
Last edited:

Greenhost

Verified User
Joined
Jan 22, 2013
Messages
115
wait_timeout=15
connect_timeout=10
interactive-timeout = 30
max_user_connections=20
You should change max_user_connections on mysql> customer.*
Code:
MAX_USER_CONNECTIONS 20;
check this link and this.
 
Top