# Database Connection Error

**URL:** <https://discourse.laminas.dev/t/database-connection-error/2054>\
**Category:** Components & MVC\
**Created:** [January 19, 2021, 7:04pm UTC](https://discourse.laminas.dev/t/database-connection-error/2054 "2021-01-19T19:04:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Panstone](https://avatars.discourse-cdn.com/v4/letter/p/5f9b8f/32.png) [@Panstone](https://discourse.laminas.dev/u/Panstone)\
**Post date:** [January 19, 2021, 7:04pm UTC](https://discourse.laminas.dev/t/database-connection-error/2054/1 "2021-01-19T19:04:27Z")

</div>

Hello!

I’m trying right now to connect my Database on my localhost to my application. But I’m getting this error message:

Connect Error: SQLSTATE[HY000] [1045] Access denied for user ‘local’@‘localhost’ (using password: NO).

Does anyone have any tipps?

Thank you!

---

<div class="post-metadata">

**Author:** ![ezkimo](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/ezkimo/32/781_2.png) [@ezkimo](https://discourse.laminas.dev/u/ezkimo)\
**Post date:** [January 20, 2021, 7:44am UTC](https://discourse.laminas.dev/t/database-connection-error/2054/2 "2021-01-20T07:44:42Z")

</div>

Hello Panstone,

can you show us how you are initializing your database? What does the code in your config file (global.php or local.php or any other config file you 're using) look like? Have you checked your database credentials before? Is `local` really the right user?

I 'm sure we can help you, when you 're showing us the settings for your database. The error message clearly says, that your credentials for accessing the database are not valid.

---

<div class="post-metadata">

**Author:** ![williamgall](https://avatars.discourse-cdn.com/v4/letter/w/b77776/32.png) [@williamgall](https://discourse.laminas.dev/u/williamgall)\
**Post date:** [February 23, 2021, 10:37pm UTC](https://discourse.laminas.dev/t/database-connection-error/2054/3 "2021-02-23T22:37:33Z")

</div>

It specifically says you are not passing a password to the database so I’d check that first. Sometimes they put the username in the global,php and the password in the local.php if thats the case make sure its in local.php and not local.php.dist

Hope that helps
