If you have too many connections on the MySQL database, you may reach a limit and no new connections can be created. The default connection limit is 100, and you may use max_connections system variable to increase the size. To see the current max_connections size, connect to the mysql and type the following commane
mysql> show variables like 'max_connections';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 100 |
+-----------------+-------+
1 row in set (0.00 sec)
mysqld actually allows max_connections+1 clients to connect. The extra connection is reserved for use by accounts that have the SUPER privilege. By granting the SUPER privilege to administrators and not to normal users (who should not need it), an administrator can connect to the server and use SHOW PROCESSLIST to diagnose problems even if the maximum number of unprivileged clients are connected.
To diagnose this problem, type the following from the MySQL client session:
mysql> show processlist;
You will see all the connections that exists. Each connection is associated with an ID, and you'll use that ID to disconnect (or kill) the connections.
mysql> kill 3004512;
To increase the max_connections and max_user_connections, please edit the /etc/my.cnf file and add the following statements.
[mysqld]
max_connections=300
It is always helpful to check your code and make sure all mysql connections are being closed properly, and change from mysql_pconnect to mysql_connect. The pconnect may not give you much speed advantage if connecting to a local mysql server.