Jump to content

Prestashop 1.7.3 SQLSTATE[HY000] [2002] database cannot be established line 120


SamIk

Recommended Posts

 

I am getting the below error after doing an upgrade when trying to log in to the BO. 

The front end shows a 500 error.

Initially I did the upgrade using 1click upgrade and that broke the site with a 500 error. I then tried to do an upgrade using Plesk and recieved the below. 

Can anyone please help?  

[PrestaShopException]

 

Link to database cannot be established:SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known
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

  • 11 months later...
  • 11 months later...

I got this issue when my server hung up during the updating of several modules. Then I sort this issue out by stop and start MySQL. In Ubuntu system, I use below commands: 

sudo service mysql stop

sudo service mysql start 

Link to comment
Share on other sites

  • 4 years later...
Posted (edited)

 

On 6/18/2020 at 5:09 AM, Fred Peng said:

I got this issue when my server hung up during the updating of several modules. Then I sort this issue out by stop and start MySQL. In Ubuntu system, I use below commands: 

sudo service mysql stop

sudo service mysql start 

Hello, how are you?

can you help me please. I got the same issue on my ps 1.7.8.11 and i stop and start the mysql. but I don't know if it is the permanent solution because my site give me the same error every morning and I have to restart the server.

Screenshotfrom2025-05-1011-10-34.thumb.png.7263332fb768353d4f77858e31bd88af.png

 

 

Edited by Najam Sajid (see edit history)
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...