If you get a Too many connections error when you try to connect to the mysq server, then it clearly means that all available connections are in use.
Too Many Connections can be caused by either a lot of simultaneous connections or by old connections not being released properly.
Factors affecting the connection of MySQL
1)mysql_pconnect()
2)mysql_connect()
3)mysqladmin flush-hosts
Along with these parameters you can also check the existing process list run this command as root
mysqladmin -u <user> -p<password> processlist
mysql_pconnect(), This creates a permanent connection to the database (permanent is defined as 8 hours by the MySQL wait_timeout system variable). It will only create a new connection if it cannot find an existing permanent connection to reuse. You need to be careful with mysql_pconnect() to make sure that you don’t run out of connections, since these stay open so long and you cannot close them with mysql_close().
mysql_connect(), This can be better than mysql_pconnect() because these connections can be short lived, and can be closed when needed with mysql_close(). An important parameter is the CLIENT_INTERACTIVE flag. If this is passed, it will use the MySQL interactive_timeout value instead of wait_timeout. Sincewait_timeout defaults to 8 hours, this seems like a great idea. However, surprisingly,interactive_timeout also defaults to 8 hours. You should change this value to something smaller that fits your system.
mysqladmin flush-hosts, That command drops dead connections.
You can also use this command when you experience these type of errors
Host ‘host_name’ is blocked because of many connection errors.
Unblock with ‘mysqladmin flush-hosts’
Solution:
As root, run the command:
mysqladmin flush-hosts
Incoming search terms:
- mysql too many connections flush (251)
- mysql too many connections fix (104)
- mysql_connect(): Too many connections (32)
- mysql_connect too many connections (26)
- xampp too many connections (14)
- Too many connections fix (12)
- mysql flush connections (10)
- mysql_connect() too many connections (10)
- unblock with mysqladmin flush-hosts windows (9)
- mysql too many connections flush hosts (8)
- Mysql2::Error (Too many connections) (8)
- too many connections mysql_connect (7)
- how to solve too many connections (6)
- fix too many connections (6)
- mysql flush too many connections (6)
- rails mysql2 too many connections (6)
- MySQL cant connect: Too many connections (6)
- mysql_connect permanent (5)
- how to fix Too Many Connections (5)
- mysql2::error: too many connections rails (5)
- too many connection in mysql flush (4)
- too many connections in mysql_connect (4)
- mysqladmin flush connections (4)
- unblock with \mysqladmin flush-hosts\ windows (3)
- Mysql2::Error: Too many connections (3)
- how to resolve too many connections (3)
- Too many connections (3)
- too many connections (mysql2::error) (3)
- mysqladmin flush-hosts (3)
- mysqlconnect too many connections (3)
- mysqladmin flush-hosts windows (3)
- flush mysql too many connections (3)
- mysqladmin flush-hosts too many connections (3)
- host is blocked because of many connection errors; unblock with \mysqladmin flush-hosts\ oracle (3)
- too many connections mysql (3)
- mysql_connect: Too many connections (3)
- mysql too many connections get in as root (3)
- mysql too many connection flush (3)
- to many connections mysql (3)
- unblock with mysqladmin flush tutorial (3)
You will also be interested in ,
- Export MySql database table to pdf using php
- How to run a SQL query in phpMyAdmin
- Total Number Of Rows In MYSQL
- Remote Mysql Connection From CPANEL And Connect To MYSQL Database From Your Local Webserver or Other External Web Server
- Php mysql example image gallery blob storage
- Image gallery using php and mysql blob storage and displaying the image from mysql blob
- Tag cloud using php, mysql and ajax with filter
- To insert the new column after a specific column using mysql
- Count distinct records or values and display it using mysql and php
- How to create random passwords using php

