Laravel 5 - 配置.env和.db文件

时间:2017-01-11 19:32:57

标签: php laravel-5 migration

我刚开始学习php / laravel。我为学习目的设置了Laravel + xampp + VB(vagrant)。一切正常,直到我试图做

php artisan migrate

我得到了:

[Illuminate\Database\QueryException]
SQLSTATE[HY000] [1044] Access denied for user ''@'localhost' to database 'homestead' (SQL: select * from informatio
n_schema.tables where table_schema = homestead and table_name = migrations)

[PDOException]
SQLSTATE[HY000] [1044] Access denied for user ''@'localhost' to database 'homestead'

我非常确定我的文件配置没有加起来(我在发布之前尝试了不同的方法来修复此错误)...

.ENV

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=''

.dbphp

'connections' => [

    'sqlite' => [
        'driver' => 'sqlite',
        'database' => env('DB_DATABASE', database_path('database.sqlite')),
        'prefix' => '',
    ],

    'mysql' => [
        'driver' => 'mysql',
        'host' => env('DB_HOST', 'localhost'),
        'port' => env('DB_PORT', '3306'),
        'database' => env('DB_DATABASE', 'forge'),
        'username' => env('DB_USERNAME', 'forge'),
        'password' => env('DB_PASSWORD', ''),
        'charset' => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix' => '',
        'strict' => true,
        'engine' => null,
    ],

我不知道自己在做什么,所以我衷心希望有人能引导我走向正确的方向。我遵循本教程:https://www.youtube.com/watch?v=Tsr3NgoExfo

我这样做是为了尝试修复我的问题(没有帮助):http://tutsnare.com/access-denied-for-user-homesteadlocalhost-laravel-5/

0 个答案:

没有答案