I get following error in my laravel application. ( I am using Laravel 5.1)
PDOException in Connector.php line 55:
SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO)
at the details it says that I do not parse any password:
array('driver' => 'mysql', 'host' => 'localhost', 'database' => 'gen', 'username' => 'root', 'password' => '', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'name' => 'mysql'), array('0', '2', '0', false, false)) in MySqlConnector.php line 22
My .env file looks like this in Laravel:
APP_ENV=local
APP_DEBUG=true
APP_KEY=************************************
DB_HOST=localhost
DB_DATABASE=gen
DB_USERNAME=miad2
DB_PASSWORD=***************
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
I use phpmyadmin and created that user there.
database.php looks like this:
<?php
return [
'fetch' => PDO::FETCH_CLASS,
'default' => env('DB_CONNECTION', 'mysql'),
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'database' => storage_path('database.sqlite'),
'prefix' => '',
],
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
'pgsql' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
],
],
'migrations' => 'migrations',
'redis' => [
'cluster' => false,
'default' => [
'host' => '127.0.0.1',
'port' => 6379,
'database' => 0,
],
],
];
I stuck here for some hours and do not know how to fix this, need some help.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire