mysql 的max_connections和max_user_connections 的区别
----查看max_user_connections 默认值 MySQL> show variables like 'max_user_connections';
+----------------------+-------+
| Variable_name | Value |
+----------------------+-------+
| max_user_connections | |
+----------------------+-------+ row in set (0.00 sec) ---设置 max_user_connections
mysql> set @@global.max_user_connections=; Query OK, rows affected (0.03 sec)
mysql> select @@max_user_connections;
+------------------------+
| @@max_user_connections |
+------------------------+
| |
+------------------------+
row in set (0.00 sec)
上面参数设置完后窗口,要重新登陆一下 root@dg ~]# mysql -uroot -pmysql
然后再开一个窗口登陆就会报如下错误:
root@dg ~]# mysql -uroot -pmysql
Warning: Using a password on the command line interface can be insecure. ERROR (): User root already has more than 'max_user_connections' active connections 另外在登陆一个用户u2,正常登陆,但是在登陆一个u2用户,就会报错:
root@dg mysql]# mysql -uu2 -pu2
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.6.-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)
Copyright (c) , , Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. max_user_connections 针对用户设计的 下面我们来看看max_connections 的作用
mysql> select @@max_connections;
+-------------------+
| @@max_connections |
+-------------------+
| |
+-------------------+
row in set (0.00 sec)
mysql> set @@global.max_connections=;
Query OK, rows affected (0.00 sec)
mysql> select @@max_connections;
+-------------------+
| @@max_connections |
+-------------------+
| |
+-------------------+
row in set (0.00 sec)
上面参数设置完后窗口,要重新登陆一下
[root@dg mysql]# mysql -uroot -pmysql
在开一个窗口session2正常登陆:
[root@dg mysql]# mysql -uroot -pmysql
再开第三个窗口,session3 登陆的时候报错
[root@dg ~]# mysql -uroot -pmysql
Warning: Using a password on the command line interface can be insecure.
ERROR (HY000): Too many connections
[root@dg ~]# mysql -uu2 -pu2
Warning: Using a password on the command line interface can be insecure.
ERROR (HY000): Too many connections 实验完毕后,改回原来的参数
mysql> set @@global.max_user_connections=;
Query OK, rows affected (0.00 sec) mysql> select @@max_user_connections;
+------------------------+
| @@max_user_connections |
+------------------------+
| |
+------------------------+
row in set (0.00 sec)
mysql> set @@global.max_connections=;
Query OK, rows affected (0.00 sec)
mysql> select @@max_connections;
+-------------------+
| @@max_connections |
+-------------------+
| |
+-------------------+
row in set (0.00 sec) 结论: max_user_connections:限制每个用户的session连接个数,例如max_user_connections= ,那么用户u1只能连接的session数为1,如果还有用户u2,还是可以连接,但是连接数仍然为1
max_connections :是对整个服务器的用户限制,整个服务器只能开这么多session,而不考虑用户!
mysql 的max_connections和max_user_connections 的区别的更多相关文章
- mysql中max_connections与max_user_connections使用区别
问题描述:把max_connections和max_user_connections参数进行分析测试,顾名思义,max_connections就是负责数据库全局的连接数,max_user_connec ...
- mysql实例的连接数max_user_connections 和max_connections 配置的那些事
今天在查线上问题时,通过phpMyAdmin来进行DML操作,发现比平时慢多了,就各种进原因. 项目的场景是一个mysql实例中创建了多个数据库,猜想可能是相互影响所致. 然后,查询线上Mysql数据 ...
- 用count(*)还是count(列名) || Mysql中的count()与sum()区别
Mysql中的count()与sum()区别 首先创建个表说明问题 CREATE TABLE `result` ( `name` varchar(20) default NULL, `su ...
- 第三章(附)mysql表类型MyISAM和InnoDB区别(决定了是否支持事务)
mysql表类型MyISAM和InnoDB区别 MyISAM:这个是默认类型,它是基于传统的ISAM类型,ISAM是Indexed Sequential Access Method (有索引的顺序访问 ...
- (转)MySQL中In与Exists的区别
背景:总结mysql相关的知识点. 如果A表有n条记录,那么exists查询就是将这n条记录逐条取出,然后判断n遍exists条件. select * from user where exists s ...
- MySQL中interactive_timeout和wait_timeout的区别【转】
在用mysql客户端对数据库进行操作时,打开终端窗口,如果一段时间没有操作,再次操作时,常常会报如下错误: ERROR 2013 (HY000): Lost connection to MySQL s ...
- Mysql中函数和存储过程的区别
Mysql中函数和存储过程的区别 存储过程: 1. 可以写sql语句 2. inout,out构造返回值 3. 调用:call:存储过程名称 4. 可以 ...
- MySQL存储过程中的3种循环,存储过程的基本语法,ORACLE与MYSQL的存储过程/函数的使用区别,退出存储过程方法
在MySQL存储过程的语句中有三个标准的循环方式:WHILE循环,LOOP循环以及REPEAT循环.还有一种非标准的循环方式:GOTO,不过这种循环方式最好别用,很容易引起程序的混乱,在这里就不错具体 ...
- [转]Mysql几种索引类型的区别及适用情况
此为转载文章,仅做记录使用,方便日后查看,原文链接:https://www.cnblogs.com/yuan-shuai/p/3225417.html Mysql几种索引类型的区别及适用情况 如大 ...
随机推荐
- oracle 数据库信息查询
/*查询当前用户表信息/ select A.column_name 字段名, A.data_type 数据类型, A.data_length 长度, A.data_precisi ...
- hbase数据迁移-HDFS拷贝
1.把数据表test从hbase下拷出 hdfs dfs -get /hbase/data/default/test /home/hadoop/hbase/test 2.文件放到新集群的系统上 scp ...
- svn回滚版本
1.本地修改了内容,但是没有commit可以通过Revert-来覆盖当前版本. 2.已经commit了.首先第一步,应该知道需要回滚的版本编号, 第二步,选择 updata to revision
- MYSQL 处理批量更新数据的一些经验。
首先,我们需要了解下MYSQL CASE EXPRESSION 语法. 手册传送门:http://dev.mysql.com/doc/refman/5.7/en/control-flow-functi ...
- odi 12.2.1.1新特性
ODI 12.2.1.1现在已经发布,也可以OTN上下载,主要变化: Hyperion Essbase and Hyperion Planning 知识模块 Hyperion Essbase and ...
- angularjs的简单应用(一)
AngularJS是为了克服html在构建应用上的不足而设计的.HTML是一门很好的为静态文本展示设计的声明式语言,但要构建WEB应用的话它就显得乏力了. AngularJS使用了不同的方法,它尝试去 ...
- C#方法参数传递机制
1:value(值传递).ref(引用传递).out(输出传递) ref和out使用效果上面是等效的,它们的区别在于:参数标记为ref,那么必须在调用函数之前初始化参数的值:参数标记为out,调用函数 ...
- Ubuntu 使用Cisco VPN、AnyConnect、OpenConnect的方法。
自己建的廉价Shadowsocks服务器总是不稳定,众所周知,PPTP在中国大陆已经废了.为了连接外网,所以购买了BlueCloud的VPN.但是他们家的VPN是使用Cisco VPN,可以使用Any ...
- NOIP 考前 暴力练习
BZOJ 1028 暴力枚举听的那张牌,和那个多余的两张牌,其余的mod3后模拟就可以了 #include <cstdio> ; int n,m,a[Maxn],b[Maxn],cnt,A ...
- 向peersim开火!P2P开火!(安装和样例运行)
根据导师的要求,这次的任务是要模拟一个类似BT网络的P2P网络,并实现一些算法,查了些资料,都说NS2对于P2P网络的模拟和支持都不好,基本没有模板可以用,而且效率很低,只能模拟几万个节点左右,看到挺 ...