Database not configured during migration

This may be a repeat question. But I had no luck with the previous answers

I am just git clonea laravel project. Now I tried to do it php artisan migrate. It returns an error below.

[InvalidArgumentException]   
Database [] not configured.

and

migrate [--bench[="..."]] [--database[="..."]] [--force] [--path[="..."]] [--package[="..."]] [--pretend] [--seed]

my app/config/database.phplooks like this:

    'mysql' => array(
        'driver'    => 'mysql',
        'host'      => 'localhost',
        'database'  => 'upgrade',
        'username'  => 'root',
        'password'  => 'root',
        'charset'   => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix'    => '',
    ),

I am creating a database upgradein mysql.

Can someone tell me what I am doing wrong?

early.

+7
source share
3 answers

I had the same problem. I cloned the L5.1 project from GIT and I completed

composer install 
composer update 

as well as the configured database data in .env (by default .env is not, so I took a copy of .env.example and renamed it to .env). After that, when trying to run

 php artisan migrate

, @users4393829. , .

 php artisan tinker
 >>> Config::get('database.connections.mysql.database');
 >>>null
 >>>Config::set('database.connections.mysql.database','homesteaed');
 >>>Config::get('database.connections.mysql.database');
 >>>homesteaed

, , database.php, "config" . , - GIT .

+7

.env ,

+1

, , : php artisan config:cache

0

Source: https://habr.com/ru/post/1598945/


All Articles