# Please Help me ! Error establishing a database connection

**URL:** https://community.localwp.com/t/please-help-me-error-establishing-a-database-connection/5167
**Category:** Support
**Created:** [February 9, 2018, 8:25am UTC](https://community.localwp.com/t/please-help-me-error-establishing-a-database-connection/5167 "2018-02-09T08:25:38Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Isa](https://avatars.discourse-cdn.com/v4/letter/i/c68b51/32.png) [@Isa](https://community.localwp.com/u/Isa)
#### Post date: [February 9, 2018, 8:25am UTC](https://community.localwp.com/t/please-help-me-error-establishing-a-database-connection/5167/1 "2018-02-09T08:25:38Z")

</div>

Hi !  
My local website is down. The error is “Error establishing a database connection”

I try this method :  
define(‘WP\_ALLOW\_REPAIR’, true); in wp-config.php  
and  
[http://www.mysite.com/wp-admin/maint/repair.php](http://www.mysite.com/wp-admin/maint/repair.php)

But it doesn’t make. ;-;

I try enter in a database adminer but it doesn’t make too

it say : “No such file or directory”

If it has another method, please help me.

PS. I’m sorry my english is bad n.n" please answer me with simples words. thank you

---

<div class="post-metadata">

### Author: ![jb510](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/jb510/32/4418_2.png) [@jb510](https://community.localwp.com/u/jb510)
#### Post date: [February 11, 2018, 4:59am UTC](https://community.localwp.com/t/please-help-me-error-establishing-a-database-connection/5167/2 "2018-02-11T04:59:42Z")

</div>

Hi Isa.

Did you accidentally replace you’re wp-config file?  
or  
Did you accidentally change the DB username and password?

Most often that is what causes “Error establishing DB connection” messages.

---

<div class="post-metadata">

### Author: ![Isa](https://avatars.discourse-cdn.com/v4/letter/i/c68b51/32.png) [@Isa](https://community.localwp.com/u/Isa)
#### Post date: [February 13, 2018, 10:32am UTC](https://community.localwp.com/t/please-help-me-error-establishing-a-database-connection/5167/3 "2018-02-13T10:32:35Z")

</div>

Hi !

> [@jb510](#):
>
> Did you accidentally replace you’re wp-config file?

My wp-config.php file is in “Local Sites/mysite/app/public/”

> [@](#):
>
> ?php  
> /\*\*
> 
> - The base configuration for WordPress
> - 
> - The wp-config.php creation script uses this file during the
> - installation. You don’t have to use the web site, you can
> - copy this file to “wp-config.php” and fill in the values.
> - 
> - This file contains the following configurations:
> - 
> - 
> - MySQL settings
> 
> - 
> - Secret keys
> 
> - 
> - Database table prefix
> 
> - 
> - ABSPATH
> 
> - 
> - @link [Editing wp-config.php « WordPress Codex](https://codex.wordpress.org/Editing_wp-config.php)
> - 
> - @package WordPress  
> \*/
> 
> // \*\* MySQL settings \*\* //  
> /\*\* The name of the database for WordPress \*/  
> define( ‘DB\_NAME’, ‘local’ );
> 
> /\*\* MySQL database username \*/  
> define( ‘DB\_USER’, ‘root’ );
> 
> /\*\* MySQL database password \*/  
> define( ‘DB\_PASSWORD’, ‘root’ );
> 
> /\*\* MySQL hostname \*/  
> define( ‘DB\_HOST’, ‘localhost’ );
> 
> /\*\* Database Charset to use in creating database tables. \*/  
> define( ‘DB\_CHARSET’, ‘utf8’ );
> 
> /\*\* The Database Collate type. Don’t change this if in doubt. \*/  
> define( ‘DB\_COLLATE’, ‘’ );
> 
> /\*\*
> 
> - Authentication Unique Keys and Salts.
> - 
> - Change these to different unique phrases!
> - You can generate these using the {@link [https://api.wordpress.org/secret-key/1.1/salt/](https://api.wordpress.org/secret-key/1.1/salt/) [WordPress.org](http://WordPress.org) secret-key service}
> - You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
> - 
> - @since 2.6.0  
> \*/  
> define(‘AUTH\_KEY’, ‘k/OzvPtR/J4TBCKAoKcsmsFbCuy/rjZvDbBWIIp+2+9LU4pCUzQbKsYYHOKN4HcBgc9m4eGgLtnNydk6zx+uNA==’);  
> define(‘SECURE\_AUTH\_KEY’, ‘L1pDSN/Jh2dB6eXHVXpH8mEJjeR1uf3plhKNmo1BduySk+jPPvM6P1JjfvmvO0FjP56aBYnTQ5Ds6vAbN3VG3g==’);  
> define(‘LOGGED\_IN\_KEY’, ‘30p3Ad3hffoxxk3CABtUnYO7RxYMonaKysEfZ0N/16mBTFNLvIAF8Fw5lmCfRonRBs0R2bAywDYxeA6GHPRRjw==’);  
> define(‘NONCE\_KEY’, ‘Sm58rALxi2yOmeX03ZShfwuGWBmmB2waRBfR630+hPQtNDyOcv8IBkgvDYAEdKjmRH55wd77J9ed398+ZAfmxw==’);  
> define(‘AUTH\_SALT’, ‘zQB1rlRR1ZH6MI/dM3yFwCCgNJPkd0zyvo1bLLvWdsiJHZT5ggK+Q3lAPFsWEu8I4WFIkxC0AR/h5WusqU4IEw==’);  
> define(‘SECURE\_AUTH\_SALT’, ‘Hoh1YopR12SSHVSjPXKJSLVlz5Z1LUzpVwMsq10GqyUoxFJwnjQlAisjw5jzKdqawkLMY0/W02UQwNP+qOdkcg==’);  
> define(‘LOGGED\_IN\_SALT’, ‘1IS/vzuAOXsVRjnsef2nrBvMIz/EQHobhYyGfKqViM9g0ww5GkWaArpO8IB3vhEDD0y//6tUMKaeQLMQ3dp2NA==’);  
> define(‘NONCE\_SALT’, ‘rfu82OLSeqX4wZgnNbwEp8NRFTBbQfxZWfEdV7YQL1eg+OmtizkZ08zjSJKRLAO2DDQA8cKhIcSR5b3iP2Uang==’);
> 
> /\*\*
> 
> - WordPress Database Table prefix.
> - 
> - You can have multiple installations in one database if you give each
> - a unique prefix. Only numbers, letters, and underscores please!  
> \*/  
> $table\_prefix = ‘wp\_’;
> 
> /\* Inserted by Local by Flywheel. See: [Administration Over SSL « WordPress Codex](http://codex.wordpress.org/Administration_Over_SSL#Using_a_Reverse_Proxy) \*/  
> if ( isset( $\_SERVER[‘HTTP\_X\_FORWARDED\_PROTO’] ) && $\_SERVER[‘HTTP\_X\_FORWARDED\_PROTO’] === ‘https’ ) {  
> $\_SERVER[‘HTTPS’] = ‘on’;  
> }
> 
> /\* Inserted by Local by Flywheel. Fixes $is\_nginx global for rewrites. _/  
> if ( ! empty( $\_SERVER[‘SERVER\_SOFTWARE’] ) && strpos( $\_SERVER[‘SERVER\_SOFTWARE’], ‘Flywheel/’ ) !== false ) {  
> $\_SERVER[‘SERVER\_SOFTWARE’] = ‘nginx/1.10.1’;  
> }  
> define(‘WP\_ALLOW\_REPAIR’, true);  
> /_ That’s all, stop editing! Happy blogging. \*/
> 
> /\*\* Absolute path to the WordPress directory. \*/  
> if ( ! defined( ‘ABSPATH’ ) )  
> define( ‘ABSPATH’, dirname( **FILE** ) . ‘/’ );
> 
> /\*\* Sets up WordPress vars and included files. \*/  
> require\_once ABSPATH . ‘wp-settings.php’;

> [@jb510](#):
>
> Did you accidentally change the DB username and password?

I think no. I don’t know how do this.

---

<div class="post-metadata">

### Author: ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/system/32/1_2.png) [@system](https://community.localwp.com/u/system)
#### Post date: [August 25, 2020, 6:33pm UTC](https://community.localwp.com/t/please-help-me-error-establishing-a-database-connection/5167/4 "2020-08-25T18:33:48Z")

</div>


