razabayani's avatar

php artisan migrate , access denied

I get these errors when I migrate

[Illuminate\Database\QueryException]
SQLSTATE[HY000] [1045] Access denied for user ''@'localhost' (using password: YES (SQL: select * from information_
schema.tables where table_schema = computersale and table_name = migrations)

and

[PDOException]
SQLSTATE[HY000] [1045] Access denied for user ''@'localhost' (using password: YES)

my configurations:

'mysql' => [
    'driver' => 'mysql',
    'host' => env('DB_HOST', 'localhost'),
    'port' => env('DB_PORT', '3306'),
    'database' => env('DB_DATABASE', 'computersale'),
    'username' => env('DB_USERNAME', 'root'),
    'password' => env('DB_PASSWORD', ''),
    'charset' => 'utf8mb4',
    'collation' => 'utf8mb4_unicode_ci',
    'prefix' => '',
    'strict' => true,
    'engine' => null,
],

and

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=computersale
DB_USERNAME=root
DB_PASSWORD=

I tried clearing the cache and config but didn't work.

0 likes
3 replies
tykus's avatar

Is the database username really empty, and a password set???

Ftoi's avatar

check if you phpmyadmin have a password put in DB_PASSWORD

Please or to participate in this conversation.