《Mysql入門解析mysql中max_connections與max_user_connections的區別》要點:
本文介紹了Mysql入門解析mysql中max_connections與max_user_connections的區別,希望對您有用。如果有疑問,可以聯系我們。
在mysql的手冊中已經對max_user_connections有一點說明,它是用來限制用戶資源的,怎么限制用戶資源呢?這里做了個小測試.
首先產看該全局變量的值
mysql> select @@max_user_connections;
+------------------------+
| @@max_user_connections |
+------------------------+
|????????????????????? 0 |
+------------------------+
1 row in set (0.00 sec)
默認情況系是為0的
為0是什么意思呢?它是說不限制用戶資源的.
在這里我改變一下它的值,并在查詢,注意這改變在服務器重啟后無效,想一直保存的話就放在選項文件里面!
mysql> set? @@global.max_user_connections=1;
Query OK, 0 rows affected (0.00 sec)
mysql> select @@max_user_connections;
+------------------------+
| @@max_user_connections |
+------------------------+
|????????????????????? 1 |
+------------------------+
1 row in set (0.00 sec)
現在我重新開啟一個連接
C:\Windows\System32>mysql -uroot -pweb
ERROR 1203 (42000): User root already has more than 'max_user_connections' activ
e connections
意思是這個用戶已經達到最大的連接數,不能再連接擁有資源!
該參數只能對整體限制資源,不能對某個用戶進行限制,如果需要對某個用戶限制的話,你可以在權限表里面看到
??????? max_questions: 0
????????? max_updates: 0
????? max_connections: 0
?max_user_connections: 0
這幾個參數可以對某個用戶進行限制.
max_connections 的意思是對整個服務器的用戶限制!
轉載請注明本頁網址:
http://www.snjht.com/jiaocheng/1186.html