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

查看:87
本文介绍了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,
        ],

希望有人可以帮助我:)

Hope someone can help me :)

推荐答案

尝试检出根目录中的".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天全站免登陆