SQLSTATE [HY000] [1040]连接太多

编程入门 行业动态 更新时间:2024-10-26 16:26:20
本文介绍了SQLSTATE [HY000] [1040]连接太多的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有时我打开错误日志文件时会看到此错误

Sometimes when I open my error log file I see this this error

[2014年6月14日19:09:55 UTC] PHP致命错误:未捕获的异常 消息"SQLSTATE [HY000]"的"PDOException" [1040]太多 连接"位于/home/root/products/db.php:2

[14-Jun-2014 19:09:55 UTC] PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [1040] Too many connections' in /home/root/products/db.php:2

堆栈跟踪:/home/root/products/db.php(2): PDO-> __ construct('mysql:host = loca ...','database','password')

Stack trace: /home/root/products/db.php(2): PDO->__construct('mysql:host=loca...', 'database', 'password')

/home/root/products/by-brand.php(2):include_once('/home/root/...')

/home/root/products/by-brand.php(2): include_once('/home/root/...')

{main}在第2行的/home/root/products/db.php中抛出

{main} thrown in /home/root/products/db.php on line 2

[2014年6月14日19:15:11 UTC] PHP致命错误:消息为'SQLSTATE [42000]的未捕获异常'PDOException':语法错误或访问 违反:1286中的未知存储引擎InnoDB /home/root/products/detail.php:8

[14-Jun-2014 19:15:11 UTC] PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1286 Unknown storage engine InnoDB in /home/root/products/detail.php:8

堆栈跟踪:/home/root/products/name.php(8):PDO-> prepare('select * 从p ...')

Stack trace: /home/root/products/name.php(8): PDO->prepare('select * from p...')

{main}在第8行的/home/root/products/name.php中抛出

{main} thrown in /home/root/products/name.php on line 8

我正在尝试通过使用$db=null;关闭每个脚本来解决此问题,但是它似乎不起作用.

I am trying to solve this issue by closing every script by using $db=null; but it doesn't seem to work.

我联系了服务提供商.他们说一切正常.您需要在最后检查错误.我只有几个用户.

I contacted the service provider. They say everything works fine. You need to check errors at the end. I have just a few users.

为什么有时会出现此错误?

Why do I somestimes get this error?

我的托管不受限制:磁盘空间不受限制.无限带宽,但仍然出现此错误.我不知道该如何解决这个问题.我希望扩大我的网站,但这些错误使我感到困惑

My hosting is unlimited: unlimited disk space. unlimited bandwidth but still I get this error. I don't know how can I solve this issue. I hope to make my website larger but these error make me confuses

我的db.php文件具有此代码.你可以检查一下吗?也许这是造成问题的原因.

My db.php file has this code. Can you check if this fine? Maybe this is causing the problem.

db.php

$db = new PDO('mysql:host=localhost;dbname=mobiles;charset=utf8', 'root', '**somePassword**'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);

推荐答案

您的连接代码没有错.

在共享主机上,无限制"表示其他用户不受资源使用限制.意味着他们可以吃饱整个游泳池,而您的消费却保持适度.

On a shared hosting, "unlimited" means other users are unrestricted with their resource using. Means they can eat up whole pool, while your consumption remains modest.

您已经在评论中被告知,请不要使用该主机.

As you've been told in comments, don't use this host.

更多推荐

SQLSTATE [HY000] [1040]连接太多

本文发布于:2023-10-26 01:19:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1528659.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:太多   SQLSTATE

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!