Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I solve laravel php artisan migrate error problem?

I'm using laravel socialite to make facebook login, following this website: Social Logins with Socialite

as soon as I type a command in the terminal:

php artisan migrate

This shows the 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')

like image 690
Johnny Jeong Avatar asked Sep 03 '19 11:09

Johnny Jeong


2 Answers

Open the .env file and edit it. Just set up correct DB credentials:

DB_CONNECTION=mysql 
DB_HOST=127.0.0.1 
DB_PORT=3306 
DB_DATABASE=          // Your Database Name
DB_USERNAME=          // Your Database Username
DB_PASSWORD=          // Your Database Password 

The DB_USERNAME should be set to root if you do not have a default username

If no password is set on the database, clear it DB_PASSWORD

After completion of .env edit must be clear cache: php artisan config:cache

After Run the migrate Artisan command: php artisan migrate

like image 184
Udhav Sarvaiya Avatar answered Oct 11 '22 19:10

Udhav Sarvaiya


The database called laravel cannot be found in PhpMyAdmin

Please follow these steps to solve this problem :

  1. Go to phpmyadmin in your localhost dashboard

  2. Create a database and name it laravel

  3. run the php artisan migrate CMD or Terminal of your editor

like image 11
kwaku takyi Avatar answered Oct 11 '22 19:10

kwaku takyi