I am fairly new to Laravel framework. I keep getting this error when trying to register a user. I am able to do table migration so I know the connection works.Below is the info I have in my .env file. I am able to successfully migrate too, check below.
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=classified
DB_USERNAME=root
DB_PASSWORD=null
current config of database.php file
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'classified'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', null),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],
The database also holds the migrated SQL files. So the connection works, however actually trying to register or login throws that error.
1/2
PDOException in Connector.php line 68:
SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)
2/2
QueryException in Connection.php line 647:
SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES) (SQL: select count(*) as aggregate from `users` where `email` = user@gmail.com)
I am using MySQL and not using Homestead .I do not know where exactly it's getting the information from that it's trying to use, but if its not from the .env. This is a new install made minutes ago. All I did was enter the MySQL data in, perform auth, migrate to register. I am using Laravel 5.4
use these commands:
php artisan config:clear
php artisan cache:clear
php artisan config:cache
Then run again
Try to clear your config first php artisan config:clear
. See if it works.
Restart Laraver Server
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.