Laravel:SQLSTATE[28000] [1045] 用户 'homestead'@'localhost' 访问被拒绝 [英] Laravel: SQLSTATE[28000] [1045] Access denied for user 'homestead'@'localhost'

查看:37
本文介绍了Laravel:SQLSTATE[28000] [1045] 用户 'homestead'@'localhost' 访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚安装了 laravel 并进行了迁移.但是当我尝试运行它时,我收到此错误:

I just installed laravel and made a migration. But when i try to run it i get this error:

[PDOException]                                                               
  SQLSTATE[28000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)  

谁能告诉我怎么了?我认为 Database.php 文件看起来与正常情况不同.这是新 Laravel 中的新东西吗?

Can anyone tell me what is wrong? I think the Database.php file looks different than normal. Is this something new in the new Laravel?

我的数据库配置:

'mysql' => [
            'driver'    => 'mysql',
            'host'      => env('DB_HOST', 'localhost'),
            'database'  => env('DB_DATABASE', 'LaraBlog'),
            'username'  => env('DB_USERNAME', 'root'),
            'password'  => env('DB_PASSWORD', 'root'),
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
            'strict'    => false,
        ],

希望有人能帮助我:)

推荐答案

尝试检查根目录中的.env"文件.这些值首先被采用.如果 .env 文件中没有给出,则您的只是默认值.

Try to check out the ".env" file in your root directory. These values are taken first. Yours are just the defaults if there are none given in the .env file.

DB_CONNECTION=mysql 
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=Your_Database_Name
DB_USERNAME=Your_UserName
DB_PASSWORD=Your_Password

这篇关于Laravel:SQLSTATE[28000] [1045] 用户 'homestead'@'localhost' 访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆