4

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

[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

$config = new Zend_Config_Ini(ROOT_DIR.'/application/config.ini', 'general');
$DB = Zend_Db::factory($config->db);
Zend_Db_Table::setDefaultAdapter($DB);
1
  • It looks as if your script cannot connec to the mysql server. Did you check the mysql web site to see what those error codes mean? Commented Mar 13, 2012 at 11:02

3 Answers 3

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

 db.params.host = localhost

if and only if you are using locally may be it works.

Sign up to request clarification or add additional context in comments.

Comments

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:

[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

1 Comment

hi Marek Sebara, what changes did you add to my answer? I cannot identify them other than the "newline" characters. It says "24 characters are added", but I dont see them
0

Did you check your mysql database is up?

If you are sure it is, check that your adapters configuration is ok, maybe the host parameter is not properly configured.

2 Comments

how to know that mysql is up ?? both apache and my sql are running.i am editing my question so that u see some more code
try connecting to mysql through command line "mysql.exe -uroot -p -h 192.168.0.233" or you can try with "telnet 192.168.0.233 3306" if you don't have mysql installed on your host.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.