Home > Back-end >  laravel php artisan migrate error problem
laravel php artisan migrate error problem

Time:04-15

Illuminate\Database\QueryException 
  SQLSTATE[HY000] [1049] Unknown database 'first_site' (SQL: select * from information_schema.tables where table_schema = first_site and table_name = migrations and table_type = 'BASE TABLE')
  
            throw new QueryException(
             $query, $this->prepareBindings($bindings), $e
   
  
  1   C:\laragon\www\first_site\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
      PDOException::("SQLSTATE[HY000] [1049] Unknown database 'first_site'")
  2   C:\laragon\www\first_site\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
      PDO::__construct("mysql:host=localhost;port=3306;dbname=first_site", "root", "", [])

CodePudding user response:

It throws error because your running command with out creating database named

first_site

After creating database, run command

php artisan migrate

It will work

maybe it will helpful

CodePudding user response:

Go to your data base and select SQL and run this query also you can create data base without query just click on data base and make new one:

CREATE DATABASE databasename;

Then come back and try :

php artisan migrate
  • Related