----查看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 的区别的更多相关文章

  1. mysql中max_connections与max_user_connections使用区别

    问题描述:把max_connections和max_user_connections参数进行分析测试,顾名思义,max_connections就是负责数据库全局的连接数,max_user_connec ...

  2. mysql实例的连接数max_user_connections 和max_connections 配置的那些事

    今天在查线上问题时,通过phpMyAdmin来进行DML操作,发现比平时慢多了,就各种进原因. 项目的场景是一个mysql实例中创建了多个数据库,猜想可能是相互影响所致. 然后,查询线上Mysql数据 ...

  3. 用count(*)还是count(列名) || Mysql中的count()与sum()区别

    Mysql中的count()与sum()区别   首先创建个表说明问题 CREATE TABLE `result` (   `name` varchar(20) default NULL,   `su ...

  4. 第三章(附)mysql表类型MyISAM和InnoDB区别(决定了是否支持事务)

    mysql表类型MyISAM和InnoDB区别 MyISAM:这个是默认类型,它是基于传统的ISAM类型,ISAM是Indexed Sequential Access Method (有索引的顺序访问 ...

  5. (转)MySQL中In与Exists的区别

    背景:总结mysql相关的知识点. 如果A表有n条记录,那么exists查询就是将这n条记录逐条取出,然后判断n遍exists条件. select * from user where exists s ...

  6. MySQL中interactive_timeout和wait_timeout的区别【转】

    在用mysql客户端对数据库进行操作时,打开终端窗口,如果一段时间没有操作,再次操作时,常常会报如下错误: ERROR 2013 (HY000): Lost connection to MySQL s ...

  7. Mysql中函数和存储过程的区别

    Mysql中函数和存储过程的区别 存储过程: 1.       可以写sql语句 2.       inout,out构造返回值 3.       调用:call:存储过程名称 4.       可以 ...

  8. MySQL存储过程中的3种循环,存储过程的基本语法,ORACLE与MYSQL的存储过程/函数的使用区别,退出存储过程方法

    在MySQL存储过程的语句中有三个标准的循环方式:WHILE循环,LOOP循环以及REPEAT循环.还有一种非标准的循环方式:GOTO,不过这种循环方式最好别用,很容易引起程序的混乱,在这里就不错具体 ...

  9. [转]Mysql几种索引类型的区别及适用情况

    此为转载文章,仅做记录使用,方便日后查看,原文链接:https://www.cnblogs.com/yuan-shuai/p/3225417.html Mysql几种索引类型的区别及适用情况   如大 ...

随机推荐

  1. 浅谈c语言结构体

    对于很多非计算机专业来说,c语言课程基本上指针都不怎么讲,更别说后面的结构体了.这造成很多学生对结构体的不熟悉.这里我就浅谈一下我对结构体的认识. 结构体,就是我们自己定义出一种新的类型,定义好之后, ...

  2. Android两个页面之间的切换效果工具类

    import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; ...

  3. SharePoint Site "Regional Settings"功能与CSOM的对应

    博客地址:http://blog.csdn.net/FoxDave SharePoint网站中的区域设置:"Regional Settings",可以用CSOM通过Site的一些 ...

  4. unslider.js 实现移动web轮播

    unslider.js可以实现轮播,但是在移动端还需要另两个插件. jquery.event.move和jQuery.event.swipe : 下面就是简单的实例: <!doctype htm ...

  5. Python/dotNET Redis服务连接客户端调用SET方法的同时获取Redis服务器返回的内容

    在用Python或dotNET redis客户端连接redis服务器的时候,当你调用客户端的SET方法后同时还想得到其返回的字符串,那么需要处理一下. 1. Redis Python redis客户端 ...

  6. position窗口居中

    position的四个属性值: relative absolute fixed static 下面分别讲述这四个属性. <div id="parent">     &l ...

  7. [解决方案] pythonchallenge level 2

    http://www.pythonchallenge.com/pc/def/ocr.html 根据页面提示查看网页源代码,在最后:<!--find rare characters in the ...

  8. JQuery的一些简单操作02

    一.遍历 1.向下遍历,children.find children只能向下遍历儿子节点的所有元素,find遍历当前元素下面的所有子节点 2.向上遍历,parent,parents,parentsUn ...

  9. linux装JDK

    一.安装sun java升 级到ubuntu 11.10之后.ubuntu 默认自带的是openjdkjava.默认情况这个是能够使用的,但是如果你想搭建专业的开发环境,还是需要使用sun的靠谱.另外 ...

  10. dsaf

    fdsafds fdsa fds f dsa