# Oven install - Cakephp is not able to connect to database

**URL:** <https://discourse.cakephp.org/t/oven-install-cakephp-is-not-able-to-connect-to-database/8620>\
**Category:** Need Help\
**Created:** [November 14, 2020, 9:44am UTC](https://discourse.cakephp.org/t/oven-install-cakephp-is-not-able-to-connect-to-database/8620 "2020-11-14T09:44:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![david](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@david](https://discourse.cakephp.org/u/david)\
**Post date:** [November 14, 2020, 9:44am UTC](https://discourse.cakephp.org/t/oven-install-cakephp-is-not-able-to-connect-to-database/8620/1 "2020-11-14T09:44:25Z")

</div>

Hi, Just starting out with CakePHP (4.0.9 strawberry).  
I installed with Oven.php, all items ticked ok apart from:

#### Database

- CakePHP is NOT able to connect to the database.  
Connection to Mysql could not be established: SQLSTATE[HY000] [1045] Access denied for user ‘my\_app’@‘localhost’ (using password: YES)

I’m on Windows with xampp localhost.

Please can someone explain the steps to allow CakePHP to connect to a database and check the connection is ok.  
Thanks  
David

---

<div class="post-metadata">

**Author:** ![robertkendrick](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@robertkendrick](https://discourse.cakephp.org/u/robertkendrick)\
**Post date:** [November 14, 2020, 11:30am UTC](https://discourse.cakephp.org/t/oven-install-cakephp-is-not-able-to-connect-to-database/8620/2 "2020-11-14T11:30:16Z")

</div>

The obvious first.  
Just creating a user (my\_app) is not enough to allow access to a mysql database.  
You have to give the user permissions to access the database.  
If you have done all this then we need for information about your configuration.

---

<div class="post-metadata">

**Author:** ![david](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@david](https://discourse.cakephp.org/u/david)\
**Post date:** [November 14, 2020, 3:35pm UTC](https://discourse.cakephp.org/t/oven-install-cakephp-is-not-able-to-connect-to-database/8620/3 "2020-11-14T15:35:44Z")

</div>

Thanks Robert for your reply,  
Prior to installing with Oven.php script, I didn’t create a database or user or add any extensions to php.ini

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [November 14, 2020, 5:31pm UTC](https://discourse.cakephp.org/t/oven-install-cakephp-is-not-able-to-connect-to-database/8620/4 "2020-11-14T17:31:06Z")

</div>

Unless I’m mistaken, you need to do all of that prior to installing. It doesn’t create databases or set permissions for you, it needs you to set those things up correctly first.

---

<div class="post-metadata">

**Author:** ![david](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@david](https://discourse.cakephp.org/u/david)\
**Post date:** [November 14, 2020, 7:05pm UTC](https://discourse.cakephp.org/t/oven-install-cakephp-is-not-able-to-connect-to-database/8620/5 "2020-11-14T19:05:16Z")

</div>

Ok, so that’s my question, what do I do now?  
Do I need to uninstall, create a database and set permissions and then reinstall? Or is there a way that I can just add the database connection.  
Please could you tell me exactly what I need to do.  
Thanks

---

<div class="post-metadata">

**Author:** ![david](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@david](https://discourse.cakephp.org/u/david)\
**Post date:** [November 14, 2020, 7:36pm UTC](https://discourse.cakephp.org/t/oven-install-cakephp-is-not-able-to-connect-to-database/8620/6 "2020-11-14T19:36:27Z")

</div>

Think I found [the solution](https://book.cakephp.org/4/en/tutorials-and-examples/cms/database.html)

---

<div class="post-metadata">

**Author:** ![Jawfin](https://avatars.discourse-cdn.com/v4/letter/j/dbc845/32.png) [@Jawfin](https://discourse.cakephp.org/u/Jawfin)\
**Post date:** [November 17, 2020, 9:03pm UTC](https://discourse.cakephp.org/t/oven-install-cakephp-is-not-able-to-connect-to-database/8620/7 "2020-11-17T21:03:00Z")

</div>

Heh yea, I went through that tutorial 4 to 5 times, end to end, just to twist my mind to the thinking.

There’s a little catch you may miss, I think it could be a bug in Oven but haven’t used it in a while - in that the wizards will put your database connection parameters in the `/config/app.php` `'Datasources' => [ 'default' => 'host' => ...` etc, (and at times it doesn’t even do that) _but_ note that the settings in the `/config/app_local.php` take precedence over `/config/app.php` (note the **\_local** in the filename) so make sure that everything in that config file is correct.

Cheers
