ERROR 1040 (08004): Too many connections

  长期一来,mysql低版本中,当面对连接数陡增而出现too many connections时,往往比较棘手。今天特意在mysql社版本的8.0.17中,操作试验并记录下了。以前percona版本中就有该功能了。以后再也不用重启服务了。

mysql> show variables like '%max_conn%';
+------------------------+---------+
| Variable_name | Value |
+------------------------+---------+
| max_connect_errors | 1000000 |
| max_connections | 1024 |
| mysqlx_max_connections | 100 |
+------------------------+---------+
3 rows in set (0.00 sec) mysql> set global max_connections=2;
Query OK, 0 rows affected (0.00 sec)

# 管理端口

mysql> show variables like '%port%';
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| admin_port | 33062 |
| large_files_support | ON |
| mysqlx_port | 33060 |
| mysqlx_port_open_timeout | 0 |
| port | 3306 |
| report_host | |
| report_password | |
| report_port | 3306 |
| report_user | |
| require_secure_transport | OFF |
+--------------------------+-------+
10 rows in set (0.02 sec)

  注意:admin_port该参数不需要明确指定,你的mysql端口是3306的话,这里就显示33062.

# 打开第一个连接

[root@fudao_db_cluster_001 ~]#  mysql -utest_r -h 10.192.30.53 -p'f9p%VSfXxcY3kHLJmKIi'
mysql: [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 26
Server version: 8.0.17 MySQL Community Server - GPL Copyright (c) 2000, 2019, 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. mysql>

# 打开第二个连接

[root@fudao_db_cluster_001 local]# mysql -utest_r -h 10.192.30.53 -p'f9p%VSfXxcY3kHLJmKIi'
mysql: [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 27
Server version: 8.0.17 MySQL Community Server - GPL Copyright (c) 2000, 2019, 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. mysql>

# 打开第三个连接

[root@fudao_db_cluster_001 local]#  mysql -utest_r -h 10.192.30.53 -p'f9p%VSfXxcY3kHLJmKIi'
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1040 (08004): Too many connections
[root@fudao_db_cluster_001 local]#

# 用管理端口本地登录

[root@fudao_db_cluster_001 local]# mysql -h 127.0.0.1 -uadmin_m -p'rA75MQy*R*y@KO4z%LZe' -P 33062
mysql: [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 29
Server version: 8.0.17 MySQL Community Server - GPL Copyright (c) 2000, 2019, 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. mysql>

  从上面可以看出,当普通用户连接数满后,只能用超级用户本地127.0.0.1或者localhost登录。

[root@fudao_db_cluster_001 local]# mysql -h 10.192.30.53 -uadmin_m -p'rA75MQy*R*y@KO4z%LZe' -P 33062
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2003 (HY000): Can't connect to MySQL server on '10.192.30.53' (111)
[root@fudao_db_cluster_001 local]#

ERROR 1040 (08004): Too many connections的更多相关文章

  1. 解决MYSQL错误:ERROR 1040 (08004): Too many connections

    方法一: show processlist; show variables like 'max_connections'; show global status like 'max_used_conn ...

  2. Mysql连接数太多ERROR 1040 (HY000): Too many connections

    数据库连接报错:ERROR 1040 (HY000): Too many connections   1.查看连接数 /usr/local/mysql/bin/mysqladmin -h host - ...

  3. 【已解决】mysql连接出错:ERROR 1040 (HY000): Too many connections

    连接mysql,结果出错: ? 1 ERROR 1040 (HY000): Too many connections 去修改mysql的配置文件,然后添加: ? 1 2 3 4 5 6 7 8 9 1 ...

  4. mysql 链接数满了的错误 ERROR 1040 (HY000): Too many connections

    mysql 链接数满了的错误 ERROR 1040 (HY000): Too many connections 第一种处理方式: ./mysql -u root -p 登录成功后执行以下语句查询当前的 ...

  5. ERROR 1040 (HY000) Too many connections

    C:\Users\Jilil>mysql -u root -pEnter password: *************ERROR 1040 (HY000): Too many connecti ...

  6. mysql连接出错:ERROR 1040 (HY000): Too many connections

    1.查看mysql的最大连接数:show variables like '%max_connections%';  2. 查看服务器响应的最大连接数: 3. 设置最大连接数: set GLOBAL m ...

  7. MySQL ERROR 1040: Too many connections

    如题,本章主要讲下当服务器出现 ERROR 1040: Too many connections错误时的一些处理心得. max_connections查看 ## 查看最大连接数 SHOW VARIAB ...

  8. 打开mysql时,提示 1040,Too many connections

    打开mysql时,提示 1040,Too many connections,这样就无法打开数据库,看不了表里边的内容了. 出现这个问题的原因是,同时对数据库的连接数过大,mysql默认的最大连接数是1 ...

  9. openstack中数据库连接数太多--pymysql.err.OperationalError,1040, u'Too many connections'

    1.出现问题: openstack运行过程中出现如下问题: OperationalError: (pymysql.err.OperationalError) (1040, u'Too many con ...

随机推荐

  1. 【myeclipse2014-2017】使用相关

    1.窗口背景颜色修改 2.javascript代码块背景颜色修改 3.控制台颜色相关 4.myeclipse主题相关 5.myeclipse清除项目缓存 (1.删除work中的文件.2.删除wabap ...

  2. 嵌套的JsonObject与JSONArray的取值---JSON中嵌套JSONArray

    在复杂的JSON数据的格式中,往往会对JSON数据进行嵌套,这样取值会比之前的取值稍微复杂一点,但是只要思路清晰,其实取法还是一样的.就跟if else语句一样,如果if中套if,if中再套if,写的 ...

  3. Multi-Object-Edit With Django FormSets

    I had to write a multi-object edit table the other day for a Django project and as such I dove into ...

  4. LeetCode.985-查询后偶数的总和(Sum of Even Numbers After Queries)

    这是悦乐书的第370次更新,第398篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第232题(顺位题号是985).有一个整数数组A和一个查询数组queries. 对于第i ...

  5. pom文件中引入依赖成功了,但是jar包找不着

    编写代码的时候总是会碰到各种奇奇怪怪的问题,最近引入依赖的时候发现依赖虽然引入成功了,而且查看仓库,仓库中也存在该jar包,但是项目代码中并没有找到该jar包,重新导入reimport各种都试了还是不 ...

  6. 【6.18校内test】T1多项式输出

    日常题前废话: 首先so amazing 的一件事,因为在洛谷上立下了的flag,然后这次考试前两道题都是刚刚做过不久的题emmm(相当于白送200吗qwq,但是这阻挡不了我第三题不会的脚步qwq) ...

  7. [codeforces#592Div2]C-G题

    题目链接 感觉这场难度迷茫,个人觉得难度排序为$A<B<D=E=G<C<F$ C题: 比赛结束1500+pp,结果出分900+fst,我就是fst的睿智Orz. 题意为给出$n ...

  8. 利用BFS解决拯救007问题 -- 数据结构

    题目: 7-1 拯救007 (30 分) 在老电影“007之生死关头”(Live and Let Die)中有一个情节,007被毒贩抓到一个鳄鱼池中心的小岛上,他用了一种极为大胆的方法逃脱 —— 直接 ...

  9. jQuery-点击按钮页面滚动到顶部,底部,指定位置

    $('.scroll_top').click(function(){$('html,body').animate({scrollTop: '0px'}, 800);}); //页面滚动至顶部 $('. ...

  10. python里面列表函数的使用及注意

    1.append 在末尾插入一个内容: a= [i for i in range(1,6)] print(a) a.append(100) print(a) 2.insert 指定位置插入内容 ins ...