M
M
Maxim Volkov2019-11-21 18:18:44
Laravel
Maxim Volkov, 2019-11-21 18:18:44

Laravel - when running migrations, it gives an error - Unknown database 'laravel'?

The latest version of Laravel is installed. After the default installation, the data for connecting to the database - 'laravel' - was written in the .env file. Created a new database and changed the data in .env to connect to it:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=luxury
DB_USERNAME=luxury
DB_PASSWORD=lluxury
In PHPstorm - the connection is configured - it shows that it is successful. However, after creating migrations and trying to run, it gives an error -


Illuminate\Database\QueryException : SQLSTATE[HY000] [1049] Unknown database 'laravel' (SQL: select * from information_schema.tables where table_schema = laravel and table_name = migrations and table_type = 'BASE TABLE')

Unknown database 'laravel' - I understand that laravel, during migrations, still tries to contact the base - laravel, which was set in the default settings when installing the framework.
It turns out that changing the data for connecting to a new database in the .env file is not enough?
I ask for help in solving the problem. How to fix? Where to look?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Talalaev, 2019-11-21
@voland700

Most likely the settings were just cached.
Run the following command in the console
php artisan config:clear

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question