# bin/console - An exception occurred in driver: SQLSTATE\[HY000\] \[2002\] No such file or directory

**URL:** <https://forum.shopware.com/t/bin-console-an-exception-occurred-in-driver-sqlstate-hy000-2002-no-such-file-or-directory/67109>\
**Category:** Installation / Einstieg\
**Created:** [21. Mai 2020 um 18:33 UTC](https://forum.shopware.com/t/bin-console-an-exception-occurred-in-driver-sqlstate-hy000-2002-no-such-file-or-directory/67109 "2020-05-21T18:33:19Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucahollenbach](https://avatars.discourse-cdn.com/v4/letter/l/ecc23a/32.png) [@lucahollenbach](https://forum.shopware.com/u/lucahollenbach)\
**Post date:** [21. Mai 2020 um 18:33 UTC](https://forum.shopware.com/t/bin-console-an-exception-occurred-in-driver-sqlstate-hy000-2002-no-such-file-or-directory/67109/1 "2020-05-21T18:33:19Z")

</div>

Ich erhalte beim Ausführen unter MAMP mit&nbsp;bin/console folgenden Error:

&nbsp;

In AbstractMySQLDriver.php line 93:  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  
&nbsp; An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory &nbsp;  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;

In PDOConnection.php line 31:  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;  
&nbsp; SQLSTATE[HY000] [2002] No such file or directory &nbsp;  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;

In PDOConnection.php line 27:  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;  
&nbsp; SQLSTATE[HY000] [2002] No such file or directory &nbsp;

---

<div class="post-metadata">

**Author:** ![Wallem](https://avatars.discourse-cdn.com/v4/letter/w/53a042/32.png) [@Wallem](https://forum.shopware.com/u/Wallem)\
**Post date:** [26. Mai 2020 um 13:23 UTC](https://forum.shopware.com/t/bin-console-an-exception-occurred-in-driver-sqlstate-hy000-2002-no-such-file-or-directory/67109/2 "2020-05-26T13:23:10Z")

</div>

Moin, stehe genau vor das selbe Problem.

Hast du hierfür eine Lösung gefunden?

---

<div class="post-metadata">

**Author:** ![lucahollenbach](https://avatars.discourse-cdn.com/v4/letter/l/ecc23a/32.png) [@lucahollenbach](https://forum.shopware.com/u/lucahollenbach)\
**Post date:** [26. Mai 2020 um 16:38 UTC](https://forum.shopware.com/t/bin-console-an-exception-occurred-in-driver-sqlstate-hy000-2002-no-such-file-or-directory/67109/3 "2020-05-26T16:38:35Z")

</div>

Ja habe ich du&nbsp;muss&nbsp;die Konsole erst&nbsp;mit MAMP konfigurieren

[https://8mylez.com/blog/shopware-6-lokal-installieren-mit-mamp/](https://8mylez.com/blog/shopware-6-lokal-installieren-mit-mamp/)

---

<div class="post-metadata">

**Author:** ![ShapeAndShift](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@ShapeAndShift](https://forum.shopware.com/u/ShapeAndShift)\
**Post date:** [26. Mai 2020 um 18:48 UTC](https://forum.shopware.com/t/bin-console-an-exception-occurred-in-driver-sqlstate-hy000-2002-no-such-file-or-directory/67109/4 "2020-05-26T18:48:15Z")

</div>

Geb mal als DB Host 127.0.0.1 statt localhost an.

---

<div class="post-metadata">

**Author:** ![steff3n](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@steff3n](https://forum.shopware.com/u/steff3n)\
**Post date:** [25. Februar 2021 um 21:00 UTC](https://forum.shopware.com/t/bin-console-an-exception-occurred-in-driver-sqlstate-hy000-2002-no-such-file-or-directory/67109/5 "2021-02-25T21:00:10Z")

</div>

Ich hab es hiermit gelöst&nbsp;

```
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock
```

---

<div class="post-metadata">

**Author:** ![gintas](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/gintas/32/15565_2.png) [@gintas](https://forum.shopware.com/u/gintas)\
**Post date:** [6. Dezember 2021 um 14:23 UTC](https://forum.shopware.com/t/bin-console-an-exception-occurred-in-driver-sqlstate-hy000-2002-no-such-file-or-directory/67109/6 "2021-12-06T14:23:01Z")

</div>

This have helped me with the exact same issue!

---

<div class="post-metadata">

**Author:** ![severu](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@severu](https://forum.shopware.com/u/severu)\
**Post date:** [10. März 2023 um 00:04 UTC](https://forum.shopware.com/t/bin-console-an-exception-occurred-in-driver-sqlstate-hy000-2002-no-such-file-or-directory/67109/7 "2023-03-10T00:04:26Z")

</div>

Wo? Bei mir funktioniert gar nichts mehr, wenn ich die DATABASE\_URL von localhost auf 127.0.0.1 ändere.

---

<div class="post-metadata">

**Author:** ![capelloweb](https://avatars.discourse-cdn.com/v4/letter/c/8491ac/32.png) [@capelloweb](https://forum.shopware.com/u/capelloweb)\
**Post date:** [9. April 2024 um 22:44 UTC](https://forum.shopware.com/t/bin-console-an-exception-occurred-in-driver-sqlstate-hy000-2002-no-such-file-or-directory/67109/8 "2024-04-09T22:44:19Z")

</div>

Hatten ein ähnliches Problem in der **Entwicklungsumgebung** beim Update von 6.6.0.2 auf 6.6.1.0 über den integrierten Updater. Lösung, die folgende Spalte in der .env Datei musste wie folgt angepasst werden:  
`DATABASE_URL=mysql://root:root@127.0.0.1:3306/shopware`

---

<div class="post-metadata">

**Author:** ![Dennee](https://avatars.discourse-cdn.com/v4/letter/d/47e85d/32.png) [@Dennee](https://forum.shopware.com/u/Dennee)\
**Post date:** [10. April 2024 um 06:30 UTC](https://forum.shopware.com/t/bin-console-an-exception-occurred-in-driver-sqlstate-hy000-2002-no-such-file-or-directory/67109/9 "2024-04-10T06:30:29Z")

</div>

Habe das gleiche Problem in 6.6, aber nur wenn ich den storefront watcher laufen lasse.  
Er erkennt meine Plugins nicht mehr 😕  
„Warning: Failed to load apps. Loading apps from local. Message: An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection refused“

Die bisherigen Antworten konnten mir leider nicht helfen

---

<div class="post-metadata">

**Author:** ![sunflower](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/sunflower/32/8100_2.png) [@sunflower](https://forum.shopware.com/u/sunflower)\
**Post date:** [23. April 2024 um 16:14 UTC](https://forum.shopware.com/t/bin-console-an-exception-occurred-in-driver-sqlstate-hy000-2002-no-such-file-or-directory/67109/10 "2024-04-23T16:14:47Z")

</div>

Ich stecke ebenso an dieser Stelle.

Wo soll den da die IP angepasst werden? In der .env vor dem Update?  
Eigentlich schreibt doch die shopware-installer.phar.php diese Datei. Wenn ich darin die IP eintrage, kann man sie nicht mehr ausführen.

Grüße  
sunflower

---

<div class="post-metadata">

**Author:** ![HMichi1](https://avatars.discourse-cdn.com/v4/letter/h/aeb1de/32.png) [@HMichi1](https://forum.shopware.com/u/HMichi1)\
**Post date:** [19. Mai 2025 um 20:06 UTC](https://forum.shopware.com/t/bin-console-an-exception-occurred-in-driver-sqlstate-hy000-2002-no-such-file-or-directory/67109/11 "2025-05-19T20:06:55Z")

</div>

Ich hatte folgendes Problem nach dem Umzug zu einem neuen Hoster:  
SQLSTATE[HY000] [2002] Connection timed out  
Das Frontend und Backend funktionierten einwandfrei, jedoch kam die Fehlermeldung in der SSH-Konsole und beim Shopware-Update.

Mein Problem konnte ich lösen, indem ich die DB-Zugangsdaten in der .env.local Datei korrigierte.  
Zuvor hatte ich die DB-Zugangsdaten nur in der .htaccess via „SetEnv DATABASE\_URL …“ stehen.

---

<div class="post-metadata">

**Author:** ![jenoe](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@jenoe](https://forum.shopware.com/u/jenoe)\
**Post date:** [10. Januar 2026 um 21:30 UTC](https://forum.shopware.com/t/bin-console-an-exception-occurred-in-driver-sqlstate-hy000-2002-no-such-file-or-directory/67109/12 "2026-01-10T21:30:25Z")

</div>

Bei mir ging es danach auch noch nicht. Hatte auch ein “connection refused”

Mir ist dann noch über Docker Desktop aufgefallen, dass die Ports für MariaDb wie folge definiert waren “64198:3306”. Ich habe dann noch den Port auf dem Host (also 64198) probiert und damit ging es:

```auto
DATABASE_URL=mysql://root:root@127.0.0.1:64198/shopware

```
