MySQL参数最大连接数max_connections
1、查看最大连接数

mysql> show status like 'Threads%';
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| Threads_cached | 58 |
| Threads_connected | 57 | ###这个数值指的是打开的连接数
| Threads_created | 3676 |
| Threads_running | 4 | ###这个数值指的是激活的连接数,这个数值一般远低于connected数值
+-------------------+-------+ Threads_connected 跟show processlist结果相同,表示当前连接数。准确的来说,Threads_running是代表当前并发数 这是是查询数据库当前设置的最大连接数
mysql> show variables like '%max_connections%';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 1000 |
+-----------------+-------+ 可以在/etc/my.cnf里面设置数据库的最大连接数
[mysqld]
max_connections = 1000

2、show status
Threads_connected 当前的连接数
Connections 试图连接到(不管是否成功)MySQL服务器的连接数。
Max_used_connections 服务器启动后已经同时使用的连接的最大数量。
3、设置最大连接数

set GLOBAL max_connections=2000;
set GLOBAL max_user_connections=1500; mysql> show global variables like "max%connections";
+----------------------+-------+
| Variable_name | Value |
+----------------------+-------+
| max_connections | 2000 |
| max_user_connections | 1500 |
+----------------------+-------+
2 rows in set (0.08 sec)

说明,
系统支持的最大连接max_connections
用户能最大连接进来的数量max_user_connections
别忘记在配置文件里添加否则重启失效
max_connections=1000;
max_user_connection=600
以上设置,为自己和其他用户预留几个连接空闲
4、修改/etc/my.cnf中的max_connections
5、show processlist 显示当前正在执行的MySQL连接
6、mysqladmin -u<user> -p<pwd> -h<host> status

显示当前MySQL状态 Uptime: 13131 Threads: 1 Questions: 22 Slow queries: 0 Opens: 16 Flush tables: 1 Open tables: 1 Queries per second avg: 0.1 mysqladmin -u<user> -p<pwd> -h<host> extended-status 显示mysql的其他状态 +-----------------------------------+----------+
| Variable_name | Value |
+-----------------------------------+----------+
| Aborted_clients | 0 |
| Aborted_connects | 1 |
| Binlog_cache_disk_use | 0 |
| Binlog_cache_use | 0 |
| Bytes_received | 1152 |
| Bytes_sent | 10400 |
| Com_admin_commands | 0 |
| Com_assign_to_keycache | 0 | ............................................................. ............................................................. | Threads_cached | 2 |
| Threads_connected | 1 |
| Threads_created | 3 |
| Threads_running | 1 |
| Uptime | 13509 |
| Uptime_since_flush_status | 13509 |
+-----------------------------------+----------+

7、遇到最大连接数处理
[推荐] 使用 mysqladmin flush-hosts 命令清理一下hosts文件(不知道mysqladmin在哪个目录下可以使用命令查找:whereis mysqladmin); mysqladmin flush-hosts -h192.168.x.x -Pxxxx -uroot -pxxxx;
8、OS ulimit参数
[root@emsc ~]# ulimit -n
65535
参考
MYSQL 最大连接数设置-毛虫小臭臭-51CTO博客 http://blog.51cto.com/moerjinrong/1969909
Mysql 查看连接数,状态 最大并发数 - CSDN博客 https://blog.csdn.net/makang110/article/details/75226522
mysql 最大链接数 max_connections 设置-12917979-51CTO博客 http://blog.51cto.com/12927979/2047537
MySQL参数最大连接数max_connections的更多相关文章
- 一个Web报表项目的性能分析和优化实践(六):设置MySQL的最大连接数(max_connections)
在上一篇文章中"一个Web报表项目的性能分析和优化实践(二):MySQL数据库连接不够用(TooManyConnections)问题的一次分析和解决案例"提到,项目中新增几个数据库 ...
- CentOS7.2调整Mysql数据库最大连接数
mysql数据库最大连接数=max_connections+11:root连接,用于管理员连接数据库进行维护操作查看最大连接数:show variables like 'max_connections ...
- MySQL性能优化之max_connections配置参数浅析
这篇文章主要介绍了MySQL性能优化之max_connections配置参数浅析,本文着重讲解了3种配置max_connections参数的方法,需要的朋友可以参考下 MySQL的max_connec ...
- MySQL中的max_connections和max_user_connections 及 MySQL服务器最大连接数的合理设置
max_connections 是指整个mysql服务器的最大连接数: max_user_connections 是指每个数据库用户的最大连接数,比如:虚拟主机可以用这个参数控制每个虚拟主机用户的数据 ...
- mysql数据库参数innodb_buffer_pool_size和max_connections
接到报故,查看mysql数据库以下参数 1.innodb_buffer_pool_size 2.max_connections 该参数定义了数据缓冲区buffer pool大小,类似于oracle的d ...
- mysql实例的连接数max_user_connections 和max_connections 配置的那些事
今天在查线上问题时,通过phpMyAdmin来进行DML操作,发现比平时慢多了,就各种进原因. 项目的场景是一个mysql实例中创建了多个数据库,猜想可能是相互影响所致. 然后,查询线上Mysql数据 ...
- MySQL性能优化之max_connections参数
很多开发人员都会遇见”MySQL: ERROR 1040: Too many connections”的异常情况,造成这种情况的一种原因是访问量过高,MySQL服务器抗不住,这个时候就要考虑增加从服务 ...
- mysql参数,蛮全的
网上有很多的文章教怎么配置MySQL服务器,但考虑到服务器硬件配置的不同,具体应用的差别,那些文章的做法只能作为初步设置参考,我们需要根据自己的情况进行配置优化,好的做法是MySQL服务器稳定运行了一 ...
- mysql 查看最大连接数 设置最大连接数
方法一:进入MYSQL安装目录 打开MYSQL配置文件 my.ini 或 my.cnf查找 max_connections=100 修改为 max_connections=1000 服务里重起MY ...
随机推荐
- Chapter 4 Invitations——11
"Bella?" His voice shouldn't have been so familiar to me, as if I'd known the sound of it ...
- 【Java基础】【21IO(字符流)&字符流其他内容&递归】
21.01_IO流(字符流FileReader) 1.字符流是什么 字符流是可以直接读写字符的IO流 字符流读取字符, 就要先读取到字节数据, 然后转为字符. 如果要写出字符, 需要把字符转为字节再写 ...
- 从SQL Server CloudDBA 看云数据库智能化
最近阿里云数据库SQL Server在控制台推出了CloudDBA服务,重点解决数据库性能优化领域问题,帮助客户更好的使用好RDS数据库,这是继MySQL之后第二个关系型数据库提供类似的服务. 数 ...
- 第42章 发现(discovery) - Identity Server 4 中文文档(v1.0.0)
可以在*https://baseaddress/.well-known/openid-configuration*找到发现文档.它包含有关IdentityServer的端点,密钥材料和功能的信息. 默 ...
- [PHP] curl访问https与CA证书问题
CA证书,用来在调用HTTPS资源的时候,验证对方网站是否是CA颁布的证书,而不是自己随便生成的 curl命令1.需要下载CA证书 文件地址是 http://curl.haxx.se/ca/cacer ...
- jsp内置对象的作用范围
内置对象的作用范围是指每个内置对象的某个实例在多长时间和多大的范围中有效,即在什么样的范围内可以有效地访问同一个对象实例. 在javax.servlet.jsp.PageContext的类中定义了4个 ...
- Dynamics 365 CE中AsyncOperationBase表记录太多,影响系统性能怎么办?
微软动态CRM专家罗勇 ,回复311或者20190311可方便获取本文,同时可以在第一间得到我发布的最新博文信息,follow me!我的网站是 www.luoyong.me . 本文主要是根据微软官 ...
- Vs2017 无法调试APP
其实一切都是扯,看看有没有主活动吧 症状:能部署安装,没有快捷方式,不启动调试.XARAMIN不能在XML中配置主活动,会自动根据[Activity(Label = "AA", ...
- float与double
对数值类型的细节了解在大学里就是一带而过,自己始终也没好好看过.这是在csdn上看到的一篇文章,挺好的,记录下来. https://blog.csdn.net/Demon__Hunter/articl ...
- Tomcat安装教程
Tomcat安装教程 文档下载:https://files-cdn.cnblogs.com/files/yocichen/Tomcat安装教程.rar 注意:本教程适用Windows平台安装Tomca ...