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几种索引类型的区别及适用情况 如大 ...
随机推荐
- C++重载流运算符,将存储结构体的vector直接写入文件
我们知道,当vector很大的时候,如果使用循环的方式将其中的元素写入文件将非常费时,因此有没有办法将vector一次性写入文件呢? 采用流运算符重载的方法可以做到,不仅基本类型的vector可以一次 ...
- sql中binary_checksum(*)的用法
sql中binary_checksum(*)的用法(转) binary_checksum(*)可以用来检查修改过的行. 同一行在update后,该行的binary_checksum(*)就不同. 如 ...
- 使用Mulesoft建立webservice, simple方式,POJO
Mulesoft是使用CXF来支持web service,有三种方式 1.JAX-WS 2.Simple, POJO 3. Proxy, pass-throught 本文介绍POJO,最简单的方式 1 ...
- 更新App版本的流程
上班一年了还没有自己打包上传过APP,周五下班时项目经理手把手教了我一遍,我大致把流程在这里回顾一下: 1.首先要将svn上的代码拷贝一份到分支上,用终端操作:svn cp https://192.1 ...
- 不使用ASP.NET中的服务器控件将如何上传文件?
遇到文件的上传时,可能会有大部分的开发者喜欢使用服务器控件,虽然很方便,但是却不能很好的控制,不具灵活性. 现给出例子,使用html标签语言灵活的控制文件的上传. 1.html部分 <input ...
- Django01
1.创建django project 2.创建app 在一个project下可以创建多个app,比如运维系统这个project下面包含监控app.cmdb app等等,这些app共享project里的 ...
- 实现Launcher默认壁纸、选择壁纸定制化功能
需求功能说明: 该定制需求为在系统中增加一个新的分区如myimage,用以实现存放定制资源.例如在myimage下新建wallpaper文件夹用于存放定制的墙纸图片资源,当Launcher加载 ...
- ubuntu samba server 配置多用户访问
[share] path = /home/share/ writeable = yes browseable = yes create mask = directory mask = guest ok ...
- C# 字符串操作类
using System; using System.Collections.Generic; using System.Text; using System.Collections; using S ...
- Java中的Exception
Caused by: java.lang.IllegalArgumentException: The servlets named [XXX] and [YYY] are both mapped to ...