Jump to content

Link to database cannot be established:SQLSTATE[HY000] [2005]


Roxtion

Recommended Posts

Hi,

 

I cannot access my site www.ttemarket.com 

 

getting the following message 

 

[PrestaShopException]

Link to database cannot be established:SQLSTATE[HY000] [2005] Unknown MySQL server host '_DB_SERVER_' (2)
at line 102 in file classes/db/DbPDO.php

97. public function connect()
98. {
99. try {
100. $this->link = $this->_getPDO($this->server, $this->user, $this->password, $this->database, 5);
101. } catch (PDOException $e) {
102. throw new PrestaShopException('Link to database cannot be established:'.$e->getMessage());
103. }
104.
105. // UTF-8 support
106. if ($this->link->exec('SET NAMES \'utf8\'') === false) {
107. throw new PrestaShopException('PrestaShop Fatal error: no utf-8 support. Please check your server configuration.');
Link to comment
Share on other sites

apparently you have the wrong database hostname configured

 

 

I don't understand 

This is what I had working all the time 

The Tech at godaddy use these credentials to login to the database and it worked

but the site still down

 

<?php return array (
  'parameters' => 
  array (
    'database_host' => '127.0.0.1',
    'database_port' => '3306',
    'database_name' => 'sp_emarket',
    'database_user' => 'sp_emarket',
    'database_password' => 'xxxxxxxxxxxxx',
    'database_prefix' => 'ps_',
    'database_engine' => 'InnoDB',
Link to comment
Share on other sites

Still having problems 

now getting this error on Products page

 

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[28000] [1045] Access denied for user 'sp_emarket'@'localhost' (using password: YES)' in /home/tteadmin/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43 Stack trace: #0 /home/tteadmin/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(43): PDO->__construct('mysql:host=127....', 'sp_emarket', 

Link to comment
Share on other sites

Unfortunately I am back to square on this morning with the site down again , can't run a business with this amount of instability 

I have used wordpress for years never encountered anything like this even the Technicians at Godaddy can't figure it out and adised me to hire a Prestashop expert.

I have wasted enough time and money on this site and will now be considering going with Wordpress.

Thanks

Link to comment
Share on other sites

  • 9 months later...
On 9/16/2017 at 5:16 PM, Roxtion said:

Unfortunately I am back to square on this morning with the site down again , can't run a business with this amount of instability 

I have used wordpress for years never encountered anything like this even the Technicians at Godaddy can't figure it out and adised me to hire a Prestashop expert.

I have wasted enough time and money on this site and will now be considering going with Wordpress.

Thanks

yes

i have same problem and it take 1 month of my time and not solved ,prestashop is  worst CMS that i use

i plan to come back to WP/OpenCart

Link to comment
Share on other sites

  • 2 months later...

Have the same problem with the updato to 1.7.3.2. This is a nightmare, 3 days trying to solve several problems of the update and clients don't selling:

Fatal error: Uncaught PDOException: SQLSTATE[HY000] [1045] Access denied for user 'mymycollec'@'vxadc-36.srv.cat' (using password: YES) in /usr/home/mycollect.es/web/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43 Stack trace: #0 /usr/home/mycollect.es/web/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(43): PDO->__construct('mysql:host=46.1...', 'mymycollec', '1lY0tjNj', Array) #1 /usr/home/mycollect.es/web/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php(44): Doctrine\DBAL\Driver\PDOConnection->__construct('mysql:host=46.1...', 'mymycollec', '1lY0tjNj', Array) #2 /usr/home/mycollect.es/web/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(360): Doctrine\DBAL\Driver\PDOMySql\Driver->connect(Array, 'mymycollec', '1lY0tjNj', Array) #3 /usr/home/mycollect.es/web/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(942): Doctrine\DBAL\Connection->connect() #4 /usr/home/mycollect.es/web/src/PrestaShopBundle/Kernel/ModuleRepository.php(59): Doctrine\DBAL\Connection->quer in /usr/home/mycollect.es/web/vendor/twig/twig/lib/Twig/Loader/Chain.php on line 129

Link to comment
Share on other sites

14 minutes ago, neich78 said:

Have the same problem with the updato to 1.7.3.2. This is a nightmare, 3 days trying to solve several problems of the update and clients don't selling:

Fatal error: Uncaught PDOException: SQLSTATE[HY000] [1045] Access denied for user 'mymycollec'@'vxadc-36.srv.cat' (using password: YES) in /usr/home/mycollect.es/web/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43 Stack trace: #0 /usr/home/mycollect.es/web/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(43): PDO->__construct('mysql:host=46.1...', 'mymycollec', '1lY0tjNj', Array) #1 /usr/home/mycollect.es/web/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php(44): Doctrine\DBAL\Driver\PDOConnection->__construct('mysql:host=46.1...', 'mymycollec', '1lY0tjNj', Array) #2 /usr/home/mycollect.es/web/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(360): Doctrine\DBAL\Driver\PDOMySql\Driver->connect(Array, 'mymycollec', '1lY0tjNj', Array) #3 /usr/home/mycollect.es/web/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(942): Doctrine\DBAL\Connection->connect() #4 /usr/home/mycollect.es/web/src/PrestaShopBundle/Kernel/ModuleRepository.php(59): Doctrine\DBAL\Connection->quer in /usr/home/mycollect.es/web/vendor/twig/twig/lib/Twig/Loader/Chain.php on line 129

You should contact your hosting provider for support.  This is not a prestashop issue

Link to comment
Share on other sites

  • 9 months later...
  • 1 month later...
  • 2 months later...
  • 10 months later...

I had this problem today. The DB check was fine. The site installed fine. So I'd entered the right db credentials but I had blank pages for both shop and admin.

Apparently a character in my password was repeated in the  /app/config/parameters.php file for some reason. I've sorted that and now I see something on both front and back ends.

Link to comment
Share on other sites

  • 3 months later...

Hello, 

I'm having the same issue, when i try to access my back office :

 

[PrestaShopException]
Link to database cannot be established: SQLSTATE[HY000] [2002] Connection refused
at line 120 in file classes/db/DbPDO.php

115.     public function connect()
116.     {
117.         try {
118.             $this->link = $this->getPDO($this->server, $this->user, $this->password, $this->database, 5);
119.         } catch (PDOException $e) {
120.             throw new PrestaShopException('Link to database cannot be established: '.$e->getMessage());
121.         }
122. 
123.         $this->link->exec('SET SESSION sql_mode = \'\'');
124. 
125.         return $this->link;


DbPDOCore->connect - [line 323 - classes/db/Db.php]
DbCore->__construct - [line 234 - classes/db/Db.php] - [4 Arguments]
DbCore::getInstance - [line 48 - config/alias.php]
pSQL - [line 339 - classes/shop/Shop.php] - [1 Arguments]
ShopCore::initialize - [line 117 - config/config.inc.php]
require - [line 43 - admin/index.php] - [1 Arguments]

I tried to follow the step to access /prestashop/var/cache/prod but it seems my var directory is missing for some reason.

When i got to /app/config/parameters.php i can see my password and there seems to be no error (no repetition)

Also, I'm not a specialist and I might have missed something.

 

Could it be related to the domain ? I had 2 active domains and i renewed only one last week. I'm curious if this is a coincidence or if it's the reason my site is down.

 

Thanks a lot

Edited by boris (see edit history)
Link to comment
Share on other sites

  • 1 year later...
On 8/8/2019 at 6:45 AM, Henrik said:

What solved it for me is to delete the files in /prestashop/var/cache/prod

thanks

This worked. As I saw others have same issue and they could solve their problem with this solution, I highlighted your response as (Recommended).

P.S: If the debug mode is ON you may need to remove prod & dev folder from var/cache.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...