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几种索引类型的区别及适用情况 如大 ...
随机推荐
- mysql启动报错The server quit without updating PID file
现网mysql无法启动是很让人头疼的,数据很有可能恢复不了,解决方法如下: 查看mysql目录下的日志,根据日志来锁定错误原因(mysql的错误日志很抽象) a.如果日志不能提供任何帮助则可进行以下步 ...
- 008-Scala主构造器、私有构造器、构造器重载实战详解
008-Scala主构造器.私有构造器.构造器重载实战详解 Scala主构造器实战 无参数的主构造器 分析 1.name 需要赋初值,一般通过占位符来代表空值 2.private 声明私有的age 生 ...
- Extjs tree 更改图标
去掉 树的叶子图标 .x-tree-node-icon { display: none; //不显示图标 } 更改图标 在后台返回的json中 有 添加 iconCls 属性 如 icon ...
- DOM4J的使用
http://blog.csdn.net/redarmy_chen/article/details/12969219 http://blog.csdn.net/wlbing0625/article/d ...
- mysql,node.js
var mysql = require('mysql'); var pool = mysql.createPool({ host: 'localhost', user: 'root', passwor ...
- Google Authentication 机制原理
Google Authenticator,谷歌身份认证器,Google公司推出的一款动态口令工具,旨在解决大家Google账户遭到恶意攻击的问题.该工具主要基于TOTP(Time-Based One- ...
- ubuntu更新源(Package has no installation candidate 的问题)
最近将公司的台式机安装了ubuntu16.04,安装之后,使用apt-get install openssh-server 发现出现:Package 'openssh-server' has no i ...
- UIImage学习
UIImage A UIImage object is a high-level way to display image data. You can create images from files ...
- jsp中的正则表达式
sp中${}----是EL表达式的常规表示方式目的是为了获取{}中指定的对象(参数.对象等)的值如:${user.name}<====>User user = (User)request( ...
- java EE中使用PO和VO的注意事项
1.基本定义 PO(Persistence Object 持久化对象)是直接跟持久层数据库打交道的java Bean (model,entity,bean等叫法都是可以的),里面除了私有的成员变量之 ...