连接mysql,结果出错:

?
1
ERROR 1040 (HY000): Too many connections

去修改mysql的配置文件,然后添加:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
root@bogon:logs# vi /etc/my.cnf
[mysqld]
lower_case_table_names=1
lower_case_table_names=0
lower_case_table_names=1
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
max_connections=100
max_user_connections=100
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used (fedora >= 15).
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd
user=mysql
# Semisynchronous Replication
# http://dev.mysql.com/doc/refman/5.5/en/replication-semisync.html
# uncomment next line on MASTER
;plugin-load=rpl_semi_sync_master=semisync_master.so
# uncomment next line on SLAVE
;plugin-load=rpl_semi_sync_slave=semisync_slave.so
# Others options for Semisynchronous Replication
;rpl_semi_sync_master_enabled=1
;rpl_semi_sync_master_timeout=10
;rpl_semi_sync_slave_enabled=1
# http://dev.mysql.com/doc/refman/5.5/en/performance-schema.html
;performance_schema
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

然后重启mysqld:

?
1
2
3
4
oot@bogon:logs# service mysqld restart
Stopping mysqld:                                           [  OK  ]
Starting mysqld:                                           [  OK  ]
root@bogon:logs#

然后重新连接试试,就可以了:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
root@bogon:logs# mysql -u root -p openfire_schoolike
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 440
Server version: 5.5.44-cll-lve MySQL Community Server (GPL) by Atomicorp
Copyright (c) 2000, 2015, 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>

【总结】

当连接mysql时,出现:

ERROR 1040 (HY000): Too many connections

的错误时:

去增加mysql的最大连接数即可:

修改mysql的配置文件:

/etc/my.cnf

在[mysqld]字段中增加配置:

?
1
2
max_connections=100
max_user_connections=100

当然可以根据自己需要,设置更大的值。

然后再重启mysqld:

?
1
service mysqld restart

即可正常连接mysql。

【已解决】mysql连接出错:ERROR 1040 (HY000): 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 2002 (HY000)【转】

    今天在为新的业务线搭架数据库后,在启动的时候报错 root@qsbilldatahis-db01:/usr/local/mysql/bin# ./mysql ERROR 2002 (HY000): C ...

  3. 解决MySQL报错ERROR 2003 (HY000): Can‘t connect to MySQL server on ‘localhost:3306‘ (10061)

    解决MySQL报错ERROR 2003 HY000: Can't connect to MySQL server on 'localhost:3306' 10061   笔者在新电脑安装完 MySQL ...

  4. 解决MySQL报错ERROR 2003 (HY000) Can‘t connect to MySQL server on ‘localhost3306‘ (10061)

    解决MySQL报错ERROR 2003 HY000: Can't connect to MySQL server on 'localhost:3306' 10061 笔者在新电脑安装完 MySQL 后 ...

  5. 已解决mysql报错ERROR 1049 (42000): Unknown database ‘数据库‘

    已解决mysql报错ERROR 1049 (42000): Unknown database '数据库' 文章目录 报错问题 解决方法 福利 报错问题 粉丝群里面的一个小伙伴敲代码时发生了报错(当时他 ...

  6. 解决mysql报错ERROR 2002 (HY000)

    解决Mysql报错:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/my ...

  7. mysql 2002_解决MySQL报错ERROR 2002 (HY000)

    今天在为新的业务线搭架数据库后,在启动的时候报错 root@qsbilldatahis-db01:/usr/local/mysql/bin# ./mysql ERROR 2002 (HY000): C ...

  8. 「掘虫者说」ERROR 1040 (HY000): Too many connections 1040

    问题: Docker搭建的MySQL容器出现 "Too many connections 1040" 最大连接数修改 分析: 在联调测试线上环境的过程中,由于打算快速搭建,采用的M ...

  9. mysql报错-ERROR 1206 (HY000)- The total number of locks exceeds the lock table size-的解决方法

    mysql报错"ERROR 1206 (HY000): The total number of locks exceeds the lock table size"的解决方法 问题 ...

最新文章

  1. 字节跳动花50亿买了个什么?
  2. 《Java 核心技术卷1 第10版》学习笔记------ -理解方法调用【重载解析、静态绑定、动态绑定】
  3. 在Panel上绘图的实现
  4. c#中的socket(tcp)
  5. 学习Python技术,怎么才能更好找到工作
  6. 华为hg-526拨号加路由破解简介
  7. 约瑟夫环数学公式求解
  8. 从零开始Android游戏编程(第二版) 第十章 游戏循环的设计
  9. 分别使用御剑工具和dirsearch工具(需要在kali下进行安装)对http://159.75.16.25进行扫描, 扫描出敏感文件,敏感文件内有flag值
  10. 『ExtJS』树 异步加载数据
  11. JQueryEasyUI框架入门
  12. java控制zebra打印机_从Zebra打印机读取状态
  13. 计算机一级excel题库百度云,全国计算机等级考试一级上机Excel题库
  14. 关于显著性检验,有你想要的!
  15. Elasticsearch[学习笔记]
  16. excel数据选项卡中无从mysql导入数据/mysql for excel搞不定
  17. 百度地图API_BMap接口的使用形式
  18. GB2312-80区位编码表
  19. 炎炎夏日-恩墨小王子带你玩转“数据卫士”Data Guard
  20. problem中Project'XX'is missing required library:'[路径]\XXX.jar'解决方法

热门文章

  1. MySQL双主配置步骤
  2. Linux运维实战之用户和组
  3. 七号信令:SCCP层简介
  4. vmware esxi 查看网卡、Raid卡驱动
  5. 我对javascript对象的理解
  6. mysql索引之间的区别
  7. 深度数据包检测DPI开发解析
  8. 尽快安装修补程序!微软 Word 漏洞影响上百万人
  9. JavaScript创建对象的方法
  10. android jni研究