我是Laravel框架的新手 . 尝试注册用户时,我不断收到此错误 . 我能够进行表迁移,所以我知道连接工作.Below是我在.env文件中的信息 . 我也能成功迁移,请查看下面的内容 .
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=classified
DB_USERNAME=root
DB_PASSWORD=null
database.php文件的当前配置
'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,
],
该数据库还包含迁移的SQL文件 . 所以连接工作,但实际上尝试注册或登录抛出该错误 .
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)
我正在使用 MySQL 和 not 使用 Homestead . 我不知道's getting the information from that it'试图使用的确切位置,但如果它不是来自.env . 这是几分钟前发布的新安装 . 我所做的只是输入MySQL数据,执行auth,迁移到注册 . 我正在使用Laravel 5.4
1 回答
尝试先清除配置
php artisan config:clear
. 看看它是否有效 .重新启动Laraver Server