我正在对数据库做一些记录,并不时出现这个错误:
local.ERROR: exception 'PDOException' with message 'SQLSTATE[HY000]
[1045] Access denied for user 'homestead'@'localhost'
(using password: YES)' in
:\WEB\litraen\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:55
我有文件env。正确配置。
ENV。
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=auth
DB_USERNAME=root
DB_PASSWORD=
答案 0 :(得分:0)
请检查config/database.php
是否
'default' => env('DB_CONNECTION', 'mysql'),
在连接数组中
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'tracker'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'root'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],