Subscribe Newsletter

Your Name  : 
Email Address *  : 
  • MDunkleSr: Do you know of a way to get the full post variable using JInput? And...
  • brijmohankaradia: @Awkens @Darkblack add below line before while:...
  • brijmohankaradia: @Awkens @Darkblack add below line before while:...
  • Ahsan: Dear Bala-Krishna, I Was installing CATEGORY SEO META TAGS Plugin in my...
  • PNR Enquiry: Thanks for sharing all these website but you need one more i.e...
  • Train PNR Status: I usually use ww.pnrstatuss.in for checking Railway PNR Status...
  • Online Pnr Status: Before moving on let me tell you that your article was really...
  • Irctc Pnr Check: First of all, thanks for sharing such a valuable piece of...
  • Berita Terbaru: Thanks for tips! helpful..
  • pnrworld: Just by one click now a days passengers can check there current status...
  • remote backup service: Disaster recovery plan with certain objectives like backup...
  • ??? ?????? 2013: Microsoft Extended Windows 7 Enterprise 90-day Trial Download...
  • Indian Railway PNR Status Check: We can check PNR status online, via SMS and even...
  • Archives

  • Blog Stats

MySQL Too Many Connections Error Problem & Fix

If you are getting? Too many connections error when you try to open your website in browser, It means all available connection used by other script or mysql process. Number of connection to mysql server determined by setting in mysql conf? file.? By default,? it is 151? for MySQL 5.x and 100 for MySQL 4.x.? To change setting, open mysql conf file. In Linux it can be found (/etc/my.cnf) and in windows within installation folder. Find max_connections setting under [mysqld] section. This setting must be within [mysqld] section. Change setting which is suitable to you.

[mysqld]
max_connections=200

There are several reason that cause server to raise this error:

Persistent Connections: This is common cause of this error. If script uses persisit connection and script does? not close connection even if script terminates. To avoid this problem, try using mysql_connect() instead of mysql_pconnect(). Check this setting in third party script such as osCommerce. You can turn off this setting in php.ini file. Script using persist connection will use non-persistent connection without any warning or error if persistence connection disabled.

Server administrators can disable persistent connections for PHP scripts in php.ini file:

[MySQL]
; Allow or prevent persistent links.
mysql.allow_persistent=Off

Lower MySQL Connect Timeout: Check your mysql connect timeout setting. By default it is 60 seconds and php setting lowering below the dafault setting.

For example: following setting in .htaccess php_value mysql.connect_timeout 25

osCommerce? Setting:

The osCommerce setting mentioned by ?varo is in the catalog/includes/configure.php file:

define(‘USE_PCONNECT’, ‘false’); // use persistent connections?

It defaults to true, so mysql_pconnect() is used, and you get the error message “Warning: mysql_pconnect(): Too many connections …” Change to false for mysql_connect() to be used.


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

One Response to “MySQL Too Many Connections Error Problem & Fix”

  1. Good post and just a small update on your post after we increase the “max_connections” we need to restart our MYSQL server in order to reflect our changes.

Leave a Reply