0

I am just getting into PHP and I'm trying to get a server started and go through CakePHP's CMS tutorial. However I cannot get a database connection. I get the error: CakePHP is NOT able to connect to the database. Connection to database could not be established: SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client

I have been trying to edit my app/config/app.php file. This is what I have:

'Datasources' => [
    'default' => [
        'className' => Connection::class,
        'driver' => Mysql::class,
        'persistent' => false,
        'host' => 'localhost',
        'port' => '3306',
        'username' => 'root',
        'password' => 'THE DEFAULT PASSWORD I USED TO GET INTO phpMyAdmin',
        'database' => 'cake_cms',
        'unix_socket' => '/opt/bitnami/mysql/tmp/mysql.sock',
        //'encoding' => 'utf8mb4',
        'timezone' => 'UTC',
        'flags' => [],
        'cacheMetadata' => true,
        'log' => false,
        'quoteIdentifiers' => false,
        //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],

        'url' => env('DATABASE_URL', null),
    ],

    'test' => [
        'className' => Connection::class,
        'driver' => Mysql::class,
        'persistent' => false,
        'host' => 'localhost',
        'port' => '3306',
        'username' => 'root',
        'password' => 'THE DEFAULT PASSWORD I USED TO GET INTO phpMyAdmin',
        'database' => 'cake_cms',
        'unix_socket' => '/opt/bitnami/mysql/tmp/mysql.sock',
        //'encoding' => 'utf8mb4',
        'timezone' => 'UTC',
        'cacheMetadata' => true,
        'quoteIdentifiers' => false,
        'log' => false,
        //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
        'url' => env('DATABASE_TEST_URL', null),
    ],
],

Thanks in advance. I'm super new, so maybe I need to provide more information.

Genoe
  • 13
  • 4
  • If you have command line access (i.e. SSH) on your web server, see if you can connect to the database with the `mysql` command using these credentials. If yes, it's some PHP or Cake configuration issue. If no, see if you can telnet from there to port 3306. If you can, then it's probably a user name or password issue; if you can't, then it's maybe a firewall or MySQL configuration issue. And if you don't have any SSH access to the server at all, then none of this will help you. :-( – Greg Schmidt May 05 '20 at 01:06
  • **https://stackoverflow.com/questions/50026939/php-mysqli-connect-authentication-method-unknown-to-the-client-caching-sha2-pa** – ndm May 05 '20 at 08:48

0 Answers0