"PDOException" with the message "SQLSTATE [HY000] [2002] zend framework

Any plz tell me why am I getting this error ?? Firstly, my internet connection was good today, it’s not good, so I get this error. How can I fix this 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); 
+4
source share
3 answers

it seems your code of this part 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 address is incorrect, if so go to cmd in windows and enter ipconfig, you will get the correct IP address, paste it here or just write

  db.params.host = localhost 

if and only if you use locally, maybe it works.

+8
source

for the host / host name, try using your credentials found on the Zend Server tab β†’ PHP Cloud β†’ Browse β†’ User Settings tab ... then enter the host part in the credentials, for example:

 [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
source

Have you checked your mysql database?

If you are sure, make sure that the configuration of your adapters is in order, the host parameter may be configured incorrectly.

0
source

Source: https://habr.com/ru/post/1401141/


All Articles