php - 数据库连接失败

标签 php mysql

当我在服务器上浏览我的在线应用程序时,我遇到了这样的错误

Database Connection Failed

User coule_com@c17564 already has more than 'max_user_connections' active connections.

但这在我的本地系统中运行良好。当我在服务器中导航时,此错误随时发生。如果我刷新浏览器,我可以走得更远。但我需要解决这个问题。

谁能帮我解决这个问题?

连接代码:

function makeConnection() { 
    global $config;
    $this->ConLink = mysql_pconnect($config['DBHostName'],$config['DBUserName'],$config['DBPassword']) or die("Database Connection Failed". mysql_error());
    mysql_select_db($config['DBName'], $this->ConLink);
    return true;
}

最佳答案

您是否在完成连接后关闭它们?

如果没有,那么我会假设周围有很多数据库连接对象等待 GC 拾取它们,直到它拾取为止,您可能会耗尽可用连接。

关于php - 数据库连接失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1305196/

相关文章:

php - mt_rand() 比 rand() 更安全吗

php - .htaccess 重写 - PHP 将变量获取到假文件夹

php - MySQL 和 PHP 中的批处理?

mysql - 如果变量前有连字符,则 REGEXP 不匹配

mysql - 使用 MySQL 将 LIKE 与存储过程参数连接起来

php - 如何在 PHP 中识别 CMYK 图像

php - sibling ()错误: InvalidArgumentException: The current node list is empty

php - Joomla 3 配置值

php - RowCount() = 0 错误 php mysql

php mysql 转储不工作