手机
当前位置:查字典教程网 >编程开发 >mysql数据库 >解析mysql中max_connections与max_user_connections的区别
解析mysql中max_connections与max_user_connections的区别
摘要:在mysql的手册中已经对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:WindowsSystem32>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 的意思是对整个服务器的用户限制!

【解析mysql中max_connections与max_user_connections的区别】相关文章:

MySQL无法启动、无法停止解决方法(安全设置后容易出现)

MySQL动态创建表,数据分表的存储过程

mysql "too many connections" 错误 之 mysql解决方法

mySQL中LEN()与DATALENGTH()的区别

安装mysql noinstall zip版

Mysql中校对集utf8_unicode_ci与utf8_general_ci的区别说明

深入理解mysql SET NAMES和mysql(i)_set_charset的区别

mysql中is null语句的用法分享

php运行提示Can't connect to MySQL server on 'localhost'的解决方法

mysql中将null值转换为0的语句

精品推荐
分类导航