# Error establishing a database connection (no such file or directory)

**URL:** https://discourse.roots.io/t/error-establishing-a-database-connection-no-such-file-or-directory/21079
**Category:** bedrock
**Created:** 2021-07-08T15:53:44Z
**Posts:** 4

## Post 1 by @baba_cool — 2021-07-08T15:53:44Z

**Hello !**

I can’t connect my BedRock installation to my local SQL server. All my tools are connected but bedrock doesn’t want.

**My WP error :**  
**Warning** : mysqli\_real\_connect(): (HY000/2002): No such file or directory in **/Users/victor/MyApp/lab/php/WP/web/wp/wp-includes/wp-db.php** on line **1653**

`No such file or directory`

**My .env file :**

 ![Screenshot 2021-07-08 at 17.48.11](https://discourse.roots.io/uploads/default/original/2X/c/c0b7040a18e24053e0b9b9de2d9cf4d91c6b8caf.png)

**Other tool with same conf but without problem :**

 ![Screenshot 2021-07-08 at 18.00.33](https://discourse.roots.io/uploads/default/original/2X/5/57028edcade260c7c9dd7c1af9cd01d01e89e8c9.jpeg)

When I request a list of my databases, with :  
mysql -u \<my\_username\> -p  
show databases;

I have :  
±-------------------+  
| Database  
±-------------------+  
| information\_schema  
| mysql  
| performance\_schema  
| sys  
| wordpress  
±-------------------+

**Thanks for your help** :pray:

---

## Post 2 by @craigpearson — 2021-07-08T16:42:11Z

Try using the direct IP and port your DB is configured on instead of the localhost:

`DB_HOST='127.0.0.1:3306'`

Additionally it looks as though you have setup a databse with SSL enabled. You’ll need to either setup a local database without SSL enabled. Or configure the WP Config with SSL Database configuration, for example:

```
define('MYSQL_CLIENT_FLAGS', MYSQLI_CLIENT_SSL | MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT ); 
define('MYSQL_SSL_CA', '/path/to/your-ssl-cert.pem');
```

---

## Post 3 by @baba_cool — 2021-07-08T17:56:03Z

Thank you very much for your I tried your solutions, but the error of my PHP which was too old on my computer :sweat: So I updated it with brew (I’m on Mac OS).

`brew install php`

Everything works ! Thank you very much for your help and your responsiveness!

---

## Post 4 by @system — 2021-08-19T15:53:44Z

This topic was automatically closed after 42 days. New replies are no longer allowed.
