<tfoot id='ppIDR'></tfoot>

    <small id='ppIDR'></small><noframes id='ppIDR'>

    <legend id='ppIDR'><style id='ppIDR'><dir id='ppIDR'><q id='ppIDR'></q></dir></style></legend>
    • <bdo id='ppIDR'></bdo><ul id='ppIDR'></ul>

        <i id='ppIDR'><tr id='ppIDR'><dt id='ppIDR'><q id='ppIDR'><span id='ppIDR'><b id='ppIDR'><form id='ppIDR'><ins id='ppIDR'></ins><ul id='ppIDR'></ul><sub id='ppIDR'></sub></form><legend id='ppIDR'></legend><bdo id='ppIDR'><pre id='ppIDR'><center id='ppIDR'></center></pre></bdo></b><th id='ppIDR'></th></span></q></dt></tr></i><div id='ppIDR'><tfoot id='ppIDR'></tfoot><dl id='ppIDR'><fieldset id='ppIDR'></fieldset></dl></div>
      1. php, mysql - 数据库连接过多错误

        时间:2023-09-19
      2. <small id='Gyb7O'></small><noframes id='Gyb7O'>

          <tfoot id='Gyb7O'></tfoot>

            • <bdo id='Gyb7O'></bdo><ul id='Gyb7O'></ul>

            • <i id='Gyb7O'><tr id='Gyb7O'><dt id='Gyb7O'><q id='Gyb7O'><span id='Gyb7O'><b id='Gyb7O'><form id='Gyb7O'><ins id='Gyb7O'></ins><ul id='Gyb7O'></ul><sub id='Gyb7O'></sub></form><legend id='Gyb7O'></legend><bdo id='Gyb7O'><pre id='Gyb7O'><center id='Gyb7O'></center></pre></bdo></b><th id='Gyb7O'></th></span></q></dt></tr></i><div id='Gyb7O'><tfoot id='Gyb7O'></tfoot><dl id='Gyb7O'><fieldset id='Gyb7O'></fieldset></dl></div>
                  <tbody id='Gyb7O'></tbody>

              1. <legend id='Gyb7O'><style id='Gyb7O'><dir id='Gyb7O'><q id='Gyb7O'></q></dir></style></legend>
                  本文介绍了php, mysql - 数据库连接过多错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  大家好.我有一个奇怪的错误.我创建了一个这样的聊天:

                  Good day to all. I have an odd error. I have created a chat that works like this:

                  • 问题/答案被插入到数据库中
                  • 每 2 秒向一个 php 脚本发送一个 ajax 请求以获取新的问题/答案

                  直到今天我收到此错误时它都运行良好:

                  It worked fine until today when I got this error:

                  Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [1040] Too many connections' in /var/www/html/dbdev/include/Zend/Db/Adapter/Pdo/Abstract.php:129 
                  Stack trace: #0 /var/www/html/dbdev/include/Zend/Db/Adapter/Pdo/Abstract.php(129): PDO->__construct('mysql:host=loca...', '', '', Array) 
                  s#1 /var/www/html/dbdev/include/Zend/Db/Adapter/Pdo/Mysql.php(96): Zend_Db_Adapter_Pdo_Abstract->_connect() 
                  s#2 /var/www/html/dbdev/include/Zend/Db/Adapter/Abstract.php(448): Zend_Db_Adapter_Pdo_Mysql->_connect() 
                  s#3 /var/www/html/dbdev/include/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('select profile_...', Array) 
                  s#4 /var/www/html/dbdev/include/Zend/Db/Adapter/Abstract.php(782): Zend_Db_Adapter_Pdo_Abstract->query('select profile_...', Array) 
                  s#5 /var/www/html/dbdev/include/Profile.php(43): Zend_Db_Adapter_Abstract->fetchPairs('select profile_...') 
                  s#6 /var/www/html/dbdev/public_html/index.php(29): Profile->load() 
                  s#7 {main} Next exception 'Zend_Db_Adapter_Exception' with in /var/www/html/dbdev/include/Zend/Db/Adapter/Pdo/Abstract.php on line 144
                  

                  问题是我们没有那么多...(8)而且我认为数据库不能同时支持超过 8 到 16 个连接(在规范上写的是聊天必须支持 50-100 个用户所以8是......小).

                  The problem is that we were not that many... (8) and I don't think the db could not support more than 8 to 16 connections simultaneously (on specifications is written that the chat must support 50-100 users so 8 is... small).

                  所以...谁能告诉我为什么会发生这种情况(昨天我们 15 岁并且工作正常)以及如何解决它?谢谢您的帮助.如果您需要任何代码示例,请询问.

                  So... can any1 tell me why did this happen (yesterday we were 15 and worked fine) and how to solve it? Thank you for your help. If you need any code samples just ask.

                  推荐答案

                  Too Many Connections"错误的原因有很多.

                  There are a bunch of different reasons for the "Too Many Connections" error.

                  在 MySQL.com 上查看此常见问题解答页面:http://dev.mysql.com/doc/refman/5.5/en/too-many-connections.html

                  Check out this FAQ page on MySQL.com: http://dev.mysql.com/doc/refman/5.5/en/too-many-connections.html

                  检查您的 my.cnf 文件中的max_connections".如果不存在尝试:

                  Check your my.cnf file for "max_connections". If none exist try:

                  [mysqld]
                  set-variable=max_connections=250
                  

                  但是默认值是 151,所以你应该没问题.

                  However the default is 151, so you should be okay.

                  如果您在共享主机上,可能是其他用户占用了太多连接.

                  If you are on a shared host, it might be that other users are taking up too many connections.

                  需要注意的其他问题是持久连接的使用和磁盘空间不足.

                  Other problems to look out for is the use of persistent connections and running out of diskspace.

                  这篇关于php, mysql - 数据库连接过多错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:带有消息“SQLSTATE[22001]"的“PDOException":字 下一篇:PHP Laravel:无法建立连接,因为目标机器主动拒绝

                  相关文章

                  最新文章

                    <legend id='dv65B'><style id='dv65B'><dir id='dv65B'><q id='dv65B'></q></dir></style></legend>
                    <tfoot id='dv65B'></tfoot>
                      <bdo id='dv65B'></bdo><ul id='dv65B'></ul>

                    <small id='dv65B'></small><noframes id='dv65B'>

                      <i id='dv65B'><tr id='dv65B'><dt id='dv65B'><q id='dv65B'><span id='dv65B'><b id='dv65B'><form id='dv65B'><ins id='dv65B'></ins><ul id='dv65B'></ul><sub id='dv65B'></sub></form><legend id='dv65B'></legend><bdo id='dv65B'><pre id='dv65B'><center id='dv65B'></center></pre></bdo></b><th id='dv65B'></th></span></q></dt></tr></i><div id='dv65B'><tfoot id='dv65B'></tfoot><dl id='dv65B'><fieldset id='dv65B'></fieldset></dl></div>