boris Posted February 10, 2021 Share Posted February 10, 2021 Hello, Since 2 days i have this message 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 had two active domain but i only renewed 1 last week and I don't know if it's related. Any suggestions to fix this ? Thanks you Link to comment Share on other sites More sharing options...
Prestachamps Posted February 10, 2021 Share Posted February 10, 2021 (edited) Hi, well, if your database was created on the other domain's hosting, which you've not renewed - could be the reason, as it seems that Prestashop cannot connect to the database. You should go and ask the hosting support, as they know the best how your hosting and domains configured. Maybe you should try to use the IP of the database server in the database configuration file : /app/config/parameters.php , variable : database_host Also just for curiosity? Did you had a multistore configuration, and both domain were in a Multistore config? Kind regards, Leo Edited February 10, 2021 by Prestachamps (see edit history) 1 Link to comment Share on other sites More sharing options...
boris Posted February 10, 2021 Author Share Posted February 10, 2021 thanks for the reply, I'm not certain but I think it was multistore (Although I never used the second domain) Il will try to change the IP, if it's not working I will contact my hosting service. I will you know. Thanks you Link to comment Share on other sites More sharing options...
boris Posted February 10, 2021 Author Share Posted February 10, 2021 thanks for the reply, I'm not certain but I think it was multistore (Although I never used the second domain) Il will try to change the IP, if it's not working I will contact my hosting service. I will you know. Thanks you ----------------- edit : seems like I have a local database (i don't know what is means) so when i go to /app/config/parameters.php, database_host it's from my domain provider. Might need to check with them tomorrow, it's a small company I know close to my house. I will let you know. Link to comment Share on other sites More sharing options...
boris Posted February 24, 2021 Author Share Posted February 24, 2021 quick update : Still does not work, seems not tied to the domains. As I understand the company responsible for the hosting of my site does not make security update on the server unless I pay them (which might be fair). As other hosting platform offer the same price WITH security update I will probably make a new website from scratch with another host provider. Cheers Link to comment Share on other sites More sharing options...
boris Posted February 25, 2021 Author Share Posted February 25, 2021 Before I give up completely I found this thread : It says : On 9/24/2017 at 10:00 AM, selectshop.at said: BTW natively "localhost" and "127.0.0.1" is the same thing. The problem is on your server configuration, i.e. server directives or firewall configuration are blocking one of both. So try both: 127.0.0.1 or localhost. So I wen to /www.mysite.com/app/config and opened the parameters.php (attached picture) The only 127.0.0.1 is for mailer_host There is also not port Where should I changed the infos ? Can the error be corrected in PHPmyadmin ? Sorry if I sound like a noob i try to understand Link to comment Share on other sites More sharing options...
musicmaster Posted February 26, 2021 Share Posted February 26, 2021 It On 2/25/2021 at 5:09 PM, boris said: Before I give up completely I found this thread : It says : So I wen to /www.mysite.com/app/config and opened the parameters.php (attached picture) The only 127.0.0.1 is for mailer_host There is also not port Where should I changed the infos ? Can the error be corrected in PHPmyadmin ? Sorry if I sound like a noob i try to understand It is obvious from the part you show ("sql.n") that your database is not on localhost/127.0.0.1. At least not in its present settings. To me this seems a case where you should ask your hosting provider. It looks like they made some changes. Link to comment Share on other sites More sharing options...
boris Posted February 27, 2021 Author Share Posted February 27, 2021 23 hours ago, musicmaster said: It It is obvious from the part you show ("sql.n") that your database is not on localhost/127.0.0.1. At least not in its present settings. To me this seems a case where you should ask your hosting provider. It looks like they made some changes. I tried both 127.0.0.1 and localhost and nothing changed so I reverted back to what is was previously. My host provider ask me money to just look into this, It does not feel right as nothing have changed on my side. Thanks Link to comment Share on other sites More sharing options...
musicmaster Posted February 27, 2021 Share Posted February 27, 2021 1 hour ago, boris said: I tried both 127.0.0.1 and localhost and nothing changed so I reverted back to what is was previously. My host provider ask me money to just look into this, It does not feel right as nothing have changed on my side. Thanks Every hosting provider either has somewhere a webpage specifying how to connect to its database or sends you detailed instructions how to do so. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now