Monday, March 29, 2010

MySQL Error: Too Many Connections, Error: 1040 SQLSTATE: 08004


If you get a too many connections error,Error: 1040 SQLSTATE: 08004 (ER_CON_COUNT_ERROR), when you try to connect to the mysqld server, this means that all available connections are in use by other clients.

To increase the concurrent connections what are allowed to connect to the server, change the max_connections system variable value. The default value was 100 prior to MySQL 5.1.15. The default value is 151. If you need to support more connections, you should set a larger value for this variable.

To check what were the max concurrent number of connections to the database server so far, check the Max_used_connections status. If the max_used_connections number is closed to max_connections variable value, the max_connections number should be increased.

Please check post Setting System Variables to see how to check status and set variables. There are other server connection related variables also need to be considered when setting max_connections variables. Those variables were covered in this post: Server Connection Variables Setting and Tuning

No comments: