SQLSTATE[HY000] [1040] Too many connections Error in phpMyAdmin



I was working on a Magento store and suddenly got the error message a:4:{i:0;s:43:"SQLSTATE[HY000] [1040] Too many connections";i:1;s:2884:"#0 /lib/Zend/Db/Adapter/Pdo/Mysql.php(109): Zend_Db_Adapter_Pdo_Abstract->_connect(). After doing some research on the internet, I found that it is a common error of the phpMyAdmin, and can be solved by increasing the max_connections limit in the my.cnf file. For this when I opened the my.cnf file and cheked it there is only max_connections=10, I have just increased that parameter from 10 to 50 and its working fine. Here in this post I am trying to describe how to solve this problem, its very easy and you can solve it just by using the steps given below:

Step 1: First of all you should login to the web server by using the SSH, and I assumes that you have the root access of your server and you can connect to the server by using your credentials:

Step 2: Navigate to the etc/mysql/ and search for the my.cnf file.

Step 3: Now open this file by using the SSH Command : sudo nano etc/mysql/my.cnf

Step 4: Search for the max_connections and Increase its value (if you want unlimited just put 0 for it.), the syntax would be:

max_connections=250 OR max_connections=0

Step 5: You can do it from the MySQL as well just login to the MySQL just by using the

mysql -u [User Name] -p

Step 6: it will ask for the Password, after the login run the command below and it will increase the max_connections limit

mysql> SET GLOBAL max_connections = 250;

OR

mysql> SET GLOBAL max_connections = 0; //For Unlimited number of connection

Step 7: Save the File and restart the MySQL so that changes take effect on the server by using the Command below:

/etc/init.d/mysqld restart

If you want to learn more How to Start, Stop and Restart MySQL by using the SSH Command?

Hope it helps and you enjoyed reading, if you need the professional Magento Development we can help you, just Click on the Link and send me your requirements.

Please Like the Post on Facebook or Google+.