# Can't connect to db

**URL:** <https://forum.shopware.com/t/cant-connect-to-db/41223>\
**Category:** Shopware 3.5\
**Created:** [9. November 2016 um 10:43 UTC](https://forum.shopware.com/t/cant-connect-to-db/41223 "2016-11-09T10:43:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![stefan](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@stefan](https://forum.shopware.com/u/stefan)\
**Post date:** [9. November 2016 um 10:43 UTC](https://forum.shopware.com/t/cant-connect-to-db/41223/1 "2016-11-09T10:43:04Z")

</div>

Nach Reboot des Servers habe ich folgende Fehlermeldung beim Versuch das Backend oder Frontend im Browser zu öffnen:

&nbsp;

Ups! Ein Fehler ist aufgetreten!

Die nachfolgenden Hinweise sollten Ihnen weiterhelfen.

SQLSTATE[HY000] [2003] Can’t connect to MySQL server on ‘127.0.0.1’ (4) in Enlight/Components/Db/Adapter/Pdo/Mysql.php on line 74

Stack trace:

```
 #0 Vendor/Zend/library/Zend/Db/Adapter/Abstract.php(315): Enlight\_Components\_Db\_Adapter\_Pdo\_Mysql-\>\_connect() #1 Shopware/Bootstrap.php(84): Zend\_Db\_Adapter\_Abstract-\>getConnection() #2 [internal function]: Shopware\_Bootstrap-\>initDb() #3 Enlight/Bootstrap.php(182): call\_user\_func(Array) #4 Shopware/Bootstrap.php(22): Enlight\_Bootstrap-\>loadResource('Db') #5 Enlight/Application.php(86): Shopware\_Bootstrap-\>run() #6 shopware.php(6): Enlight\_Application-\>run() #7 {main}

```

&nbsp;

MySql is up and running, config.php wurde nicht verändert.

&nbsp;

Ich habe das gefunden: [https://forum.shopware.com/discussion/4350/geloest-fehlermeldung-in-front-backend](https://forum.shopware.com/discussion/4350/geloest-fehlermeldung-in-front-backend) - und wenn ich das script in meine config.php eintrage kommt folgender Fehler:

script:

```
 $conn = mysql\_connect($DB\_HOST,$DB\_USER,$DB\_PASSWORD); if (!$conn) echo mysql\_error(); mysql\_select\_db($DB\_DATABASE); echo mysql\_error(); exit;

```

Fehler: Can’t connect to MySQL server on ‘127.0.0.1’ (4)Access denied for user ‘www-data’@‘localhost’ (using password: NO)

&nbsp;

das ist nun sehr verwunderlich, da anscheinend shopware versucht mit user www-data auf mysql zuzugreifen, allerdings meine config.php sieht folgendermasen aus:

\<?php   
 /\*\* Shopware 3.5.4 - Database-Config \*\*/ $DB\_HOST = '127.0.0.1:3306'; $DB\_USER = 'root'; $DB\_PASSWORD = 'irgendwas'; $DB\_DATABASE = 'shopware3'; &nbsp; BITTE UM HILFE - ich habe keine Ahnung warum shopware nicht mehr funktioniert. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;

---

<div class="post-metadata">

**Author:** ![stefan](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@stefan](https://forum.shopware.com/u/stefan)\
**Post date:** [9. November 2016 um 18:16 UTC](https://forum.shopware.com/t/cant-connect-to-db/41223/2 "2016-11-09T18:16:55Z")

</div>

Gelöst,

mysql konnte sich nicht zu 127.0.0.1 verbinden, allerdings zu localhost.

_mysql -u root -p -h 127.0.0.1 -P 3306  
Enter password:  
ERROR 2003 (HY000): Can’t connect to MySQL server on ‚127.0.0.1‘ (110)_

und das Problem war, dass das Loopback interface lo nicht UP war, daher keine Verbindung zu 127.0.0.1.&nbsp;&nbsp;

_/sbin/ifconfig lo 127.0.0.1 up_

und nun geht wieder alles …

&nbsp;
