Any one plz tell me why i am getting this error ?? firstly my internet connection was good today its not good so i am getting this error.how can i fix this any idea plz??
有没有人告诉我为什么会犯这个错误?首先,今天我的网络连接很好,不太好,所以我犯了这个错误。我怎么能解决这个问题呢?
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] A
connection attempt failed because the connected party did not properly respond after a
period of time, or established connection failed because connected host has failed to
respond. ' in D:\SVN
data\WebClient_PHP\trunk\p\library\Zend\Db\Adapter\Pdo\Abstract.php:129
Stack trace: #0 D:\SVN
data\WebClient_PHP\trunk\p\library\Zend\Db\Adapter\Pdo\Abstract.php(129):
PDO->__construct('mysql:host=192....', 'root', 'root', Array) #1 D:\SVN
data\WebClient_PHP\trunk\p\library\Zend\Db\Adapter\Pdo\Mysql.php(109):
Zend_Db_Adapter_Pdo_Abstract->_connect() #2 D:\SVN
data\WebClient_PHP\trunk\p\library\Zend\Db\Adapter\Abstract.php(860):
Zend_Db_Adapter_Pdo_Mysql->_connect() #3 D:\SVN
data\WebClient_PHP\trunk\p\library\Zend\Db\Adapter\Abstract.php(930):
Zend_Db_Adapter_Abstract->quote('testing', NULL) #4 D:\SVN
data\WebClient_PHP\trunk\p\library\Zend\Auth\Adapter\DbTable.php(449): Zen
in D:\SVN
data\WebClient_PHP\trunk\p\library\Zend\Db\Adapter\Pdo\Abstract.php on line
144
this is my config.ini
这是我config.ini
[general]
db.adapter = PDO_MYSQL
db.params.host = 192.168.0.233
db.params.username = root
db.params.password = my_password
db.params.dbname = "mydatabasename"
some code from my index.php
我的index.php代码。
$config = new Zend_Config_Ini(ROOT_DIR.'/application/config.ini', 'general');
$DB = Zend_Db::factory($config->db);
Zend_Db_Table::setDefaultAdapter($DB);
3 个解决方案
#1
8
it seems that your code this portion is not working
看来您的代码这部分没有工作。
[general]
db.adapter = PDO_MYSQL
db.params.host = 192.168.0.233
db.params.username = root
db.params.password = my_password
db.params.dbname = "mydatabasename"
either the IP is not correct if so go to cmd in windows and type ipconfig you will get your correct ip paste it here OR just simply write
如果在windows和type ipconfig中使用cmd, IP是不正确的,你将得到正确的IP粘贴,或者只是简单地写。
db.params.host = localhost
if and only if you are using locally may be it works.
如果且仅当您在本地使用时,可能是有效的。
#2
3
for the hostname/host try to use your credentials found in the Zend Server -> PHP Cloud tab -> Overview page -> User Parameters tab... then make the "host" part in the credentials like this:
对于主机名/主机,请尝试在Zend Server -> PHP Cloud选项卡->概述页面->用户参数选项卡中找到您的凭证。然后把“主机”部分放在这样的凭证中:
[general]
db.adapter = PDO_MYSQL
db.params.host = CONTAINERNAME-db.my.phpcloud.com
db.params.username = ZEND_DB_USERNAME
db.params.password = ZEND_DB_USERNAME
db.params.dbname = ZEND_DB_DBNAME
#3
0
Did you check your mysql database is up?
你检查你的mysql数据库了吗?
If you are sure it is, check that your adapters configuration is ok, maybe the host parameter is not properly configured.
如果您确定它是正确的,请检查适配器配置是否正常,可能还没有正确配置主机参数。
#1
8
it seems that your code this portion is not working
看来您的代码这部分没有工作。
[general]
db.adapter = PDO_MYSQL
db.params.host = 192.168.0.233
db.params.username = root
db.params.password = my_password
db.params.dbname = "mydatabasename"
either the IP is not correct if so go to cmd in windows and type ipconfig you will get your correct ip paste it here OR just simply write
如果在windows和type ipconfig中使用cmd, IP是不正确的,你将得到正确的IP粘贴,或者只是简单地写。
db.params.host = localhost
if and only if you are using locally may be it works.
如果且仅当您在本地使用时,可能是有效的。
#2
3
for the hostname/host try to use your credentials found in the Zend Server -> PHP Cloud tab -> Overview page -> User Parameters tab... then make the "host" part in the credentials like this:
对于主机名/主机,请尝试在Zend Server -> PHP Cloud选项卡->概述页面->用户参数选项卡中找到您的凭证。然后把“主机”部分放在这样的凭证中:
[general]
db.adapter = PDO_MYSQL
db.params.host = CONTAINERNAME-db.my.phpcloud.com
db.params.username = ZEND_DB_USERNAME
db.params.password = ZEND_DB_USERNAME
db.params.dbname = ZEND_DB_DBNAME
#3
0
Did you check your mysql database is up?
你检查你的mysql数据库了吗?
If you are sure it is, check that your adapters configuration is ok, maybe the host parameter is not properly configured.
如果您确定它是正确的,请检查适配器配置是否正常,可能还没有正确配置主机参数。