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. 自定义Spring-Boot @Enable注解

    Spring-Boot中有很多Enable开头的注解,通过添加注解来开启一项功能,如 其原理是什么?如何开发自己的Enable注解? 1.原理 以@EnableScheduling为例,查看其源码,发 ...

  2. [JavaScript] console.log只在查看时才会读取这个打印的对象,并把此刻相关属性和值显示出来

      /** * 写个函数解决console.log只在查看时才会读取这个打印的对象,并把此刻相关属性和值显示出来 * @param arg */ const log = function (...ar ...

  3. python 并发编程 io模型 目录

    python 并发编程 IO模型介绍 python 并发编程 socket 服务端 客户端 阻塞io行为 python 并发编程 阻塞IO模型 python 并发编程 非阻塞IO模型 python 并 ...

  4. jquery validate 自定义校验方法

    1.引入JS jquery.min.js jquery.validate.min.js messages_zh.min.js 2.添加验证方法,第一个参数为验证方法的名称,第二个参数为验证方法. $. ...

  5. mysql生成全局id(转)

    由于数据量以及IO效率的因素,很多项目对数据支持的数据库会采取分库分表的方式.使用了分库分表之后需要解决的一个问题就是主键的生成.多个表之间的主键就不能用数据库本身的自增主键来支持,因为不同表之间生成 ...

  6. 02:Redis常见面试题

    1.1 redis基础面试题 1.什么是Redis?简述它的优缺点? 1. Redis本质上是一个Key-Value类型的内存数据库,很像memcached. 2. 整个数据库统统加载在内存当中进行操 ...

  7. spark日志+hivesql

    windows本地读取hive,需要在resource里面将集群中的hive-site.xml下载下来. <?xml version="1.0" encoding=" ...

  8. IDEA的快捷方式

    一,IDEA的快捷方式1,F8单步执行 2,F9运行调试 3,CTRL +鼠标左键=进入查看定义 4,CTRL+alt +鼠标左键=查看实现 5,Shift+F6重命名 6,alt +intsert= ...

  9. sql删除重复行和删除字段首位

    删除重复行 user_info: -- 单字段筛选重复行 SELECT *from user_info WHERE NAME in ( SELECT NAME from user_info GROUP ...

  10. CSA Lignts Out

    csa 算是热身题吧 如果是每次操作一行或一列,那么无论怎么操作,本质不同的行最多只有两种,本质不同的列也最多只有两种,那么只要把某一种行和某一种列全部翻转使得全为0即可 现在是同时操作一行一列,显然 ...