Oven install - Cakephp is not able to connect to database

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


  • 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.

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.

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

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.

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.

Think I found the solution

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.