I have this error when i try to access to my laravel home project that have db access.
I know this is a common issue, so I have already read many post and tried this:
- check if username and password was correct (The same user and password work from command line and from MySql Workbench );
- check permission on Sql Side. There is an entry for root@localhost
- clean cache .env and restart server many times. I also tried to insert temporarily the db info directly on database.php
database.php
'default' => 'mysql',
'mysql' => [
'driver' => 'mysql',
'dump_command_path' => '/opt/lampp/bin', // only the path, so without 'mysqldump' or 'pg_dump'
'dump_command_timeout' => 60 * 5, // 5 minute timeout
'dump_using_single_transaction' => true, // perform dump using a single transaction
'host' => env('DB_HOST', '10.8.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', ''),
'username' => env('DB_USERNAME', ''),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],
.env
#MYSQL
DB_HOST=127.0.0.1 //I have tried also localhost
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=