How to Resolve ?

Problem Case 1:

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection, message from server: “Too many connections”

or Problem Case 2:

MySQL ERROR 1404 : Too many connections

Solution:

  1. Login as root or admin account .
  2.  execute
    show global variables like 'max_connections'
    Out put would be like this :
    +-----------------+-------+
    | Variable_name | Value |
    +-----------------+-------+
    | max_connections | 151 |
    +-----------------+-------+
    1 row in set (0.00 sec)

    if your database connections exceed the number these error can be occurred.

  3. Solution is here set max_connections as below:
    
     SET GLOBAL max_connections = 250;

    Hope your fix is done. 🙂