dimanche 12 avril 2020

Laravel 5 on digitalocean: cannot connect to database

I have this in env file

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE={db_name}
DB_USERNAME=root
DB_PASSWORD={db_password}

I config/database.php

'default' => env('DB_CONNECTION', 'mysql'),
 'mysql' => [
        'driver' => 'mysql',
        'host' => env('DB_HOST', '127.0.0.1'),
        'port' => env('DB_PORT', '3306'),
        'database' => env('DB_DATABASE', 'forge'),
        'username' => env('DB_USERNAME', 'forge'),
        'password' => env('DB_PASSWORD', ''),
        'charset' => 'utf8mb4',
        'collation' => 'utf8mb4_unicode_ci',
        'prefix' => '',
        'strict' => false, //true is default
        'engine' => null,
    ],

That's how I got the password:

cat /root/.digitalocean_password

But I get

SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' (SQL: select * from `users` where `email` ....

I even cleared the password value in env file but ti doesn't work too. Any help please? Thanks in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire