0
'default' => [
            'className' => 'Cake\Database\Connection',
            'driver' => 'Cake\Database\Driver\Mysql',
            'persistent' => false,
            'host' => 'localhost',
            'username' => 'root',
            'password' => '000000',
            'database' => 'cakephp',
            'encoding' => 'utf8mb4',
            'timezone' => 'UTC',
            'cacheMetadata' => true,

my database in phpmyadmin in xampp is ok.

But stil the cakephp homepage says

CakePHP is NOT able to connect to the database.
Connection to database could not be established: SQLSTATE[HY000] [1045] Access denied for user 'my_app'@'localhost' (using password: YES)
  • **https://stackoverflow.com/questions/59692914/cakephp-4-0-database-configuration/59694485** – ndm Feb 08 '20 at 21:12

1 Answers1

1

I recently faced this issue and solved it by adding database configuration in config/app_local.php

As per Cakephp documentation:

The application skeleton features a config/app.php file which should contain configuration that doesn’t vary across the various environments your application is deployed in.

The config/app_local.php file should contain the configuration data that varies between environments and should be managed by configuration management, or your deployment tooling

Reference: CAKEPHP -> Configuration -> Configuring your Application

Sehdev
  • 5,486
  • 3
  • 11
  • 34