---
title: "Mysql ERROR 1040 (00000): Too many connections"
author: "qepwqnp"
date: "2013-09-23T16:38:03Z"
tags: []
categories: ["数据库"]
slug: "mysql-error-1040-00000-too-many-connections"
draft: false
lastmod: "2013-09-23T16:38:02Z"
id: 1946020
url: "https://chengjunflying.iteye.com/blog/1946020"
---

程序添加数据库数据：  
错误信息: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection, message from server: "Too many connections"

Navicat连接数据库报错  
错误信息: 1040 Too many connections

重启Mysql ：： mysql restart  
错误信息:mysql ERROR 1040 (00000): Too many connections

当出现如下情况的时候，避免用户收到影响，先重启下Mysql\[root@localhost ~]# service mysqld restart

```
[root@localhost ~]# mysql
mysql> select @@global.max_connections;
+--------------------------------------+
| @@global.max_connections |
+--------------------------------------+
| 100 | 
+--------------------------------------+
```

 

 

 

```
// 也就是说现在的最大连接数是 100，我们把他修改为500,。
mysql> set global max_connections=500; 
Query OK, 0 rows affected (0.00 sec)
```