连接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
user=mysql
 
# Semisynchronous Replication
# 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
 
;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 1040 (HY000): Too many connections

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

  3. 解决MySQL报错ERROR 2002 (HY000)【转】

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

  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. Linux异常关机后,Mysql启动出错ERROR 2002 (HY000)

    Linux异常关机后,Mysql启动或訪问时,出错: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/ ...

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

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

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

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

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

    需要重启服务器:sudo /etc/init.d/mysql restart

随机推荐

  1. 用 .NET Memory Profiler 跟踪.net 应用内存使用情况--基本应用篇(转)

    .net 框架号称永远不会发生内存泄漏,原因是其引入了内存回收的机制.但实际应用中,往往我们分配了对象但没有释放指向该对象的引用,导致对象永远无法释放.最 常见的情况就是给对象添加了事件处理函数,但当 ...

  2. iOS开发-iOS8地理位置定位

    现在的App基本上都有定位功能,旅游网站根据定位推荐旅游景点,新闻App通过地理位置推荐当地新闻,社交类的App通过位置交友,iOS中实现以上功能需要一个核心的框架CoreLocation,框架提供了 ...

  3. 机器学习、NLP、Python和Math最好的150余个教程(建议收藏)

    编辑 | MingMing 尽管机器学习的历史可以追溯到1959年,但目前,这个领域正以前所未有的速度发展.最近,我一直在网上寻找关于机器学习和NLP各方面的好资源,为了帮助到和我有相同需求的人,我整 ...

  4. MFC路径层的使用(BeginPath和EndPath函数)

    响应WM_PAINT消息的代码如下: void CTextView::OnDraw(CDC* pDC) { CTextDoc* pDoc = GetDocument(); ASSERT_VALID(p ...

  5. 使用word2vec训练中文词向量

    https://www.jianshu.com/p/87798bccee48 一.文本处理流程 通常我们文本处理流程如下: 1 对文本数据进行预处理:数据预处理,包括简繁体转换,去除xml符号,将单词 ...

  6. 简单介绍Ceph分布式存储集群

    在规划Ceph分布式存储集群环境的时候,对硬件的选择很重要,这关乎整个Ceph集群的性能,下面梳理到一些硬件的选择标准,可供参考: 1)CPU选择 Ceph metadata server会动态的重新 ...

  7. js递归遍历key

    需求:根据Json对象,查找到某key所有值 var obj = { first: "1", second: { name: "abc", mykey: &qu ...

  8. FireDAC中的SQLite(一)

    Windows client software,FireDAC supports two SQLite library linking modes: Static linking: the x86 s ...

  9. 编程王道,唯“慢”不破

    原文地址 人和人之间编程速度的差异还是很大的,有的程序猿写代码非常快,有的却常常是龟速.Jeffrey Ventrella 最近在一篇文章里探讨了这种编程速度的差异,他是绝对的龟速派代表,来看看他对编 ...

  10. js escape 与php escape

    javascript有编码函数escape()和对应的解码函数unescape(),而php中只有个urlencode和urldecode,这个编码和解码函数对encodeURI和encodeURIC ...