简体   繁体   English

在laravel中安装迁移时出错

[英]error while installing migration in laravel

i have changed all the configurations in /config/database.php and .env still got the error in command promt while entering 我已经改变了所有的配置/config/database.php.env在进入仍然有在命令PROMT错误

php artisan migrate:install

the error is: 错误是:

[invalidArgumentException] [invalidArgumentException]

Database [mysql] not configured 未配置数据库[mysql]

this is .env 这是.env

APP_ENV=local
APP_DEBUG=true
APP_KEY=aqk5XHULL8TZ8t6pXE43o7MBSFchfgy2

DB_HOST=localhost
DB_DATABASE=larashop
DB_USERNAME=root
DB_PASSWORD=

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCR

however i can create database using: 但是我可以使用以下方法创建数据库:

php artisan make:migration employees

Your .env file and /config/database.php file should like be follow 您的.env文件和/config/database.php文件应遵循

.env .env

    DB_HOST=localhost
    DB_DATABASE=your_db_name
    DB_USERNAME=your_db_user_name
    DB_PASSWORD=your_password

/config/database.php /config/database.php

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

Try also php artisan migrate 也尝试php artisan migrate

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM