skip to Main Content

when typing the command php artisan migrate, it is giving me an error:

IlluminateDatabaseQueryException : SQLSTATE[HY000] [1049] Unknown 
database 'proj' (SQL: select * from information_schema.tables where 
table_schema = proj and table_name = migrations and table_type = 'BASE 
TABLE')

Although, i edited the .env file and i had created the database proj and restart the cmd and also i tried

php artisan config:cache

and similar commands but still not working

view error image

phpmyadmin view

.env file view

2

Answers


  1. This means that you don’t have this database created. First create the database and after run: php artisan migrate:fresh to create the tables.

    By the screenshots you have uploaded, you have many servers. Check the port of the server mysql and change the port on the .env file. This will work.

    Login or Signup to reply.
  2. Open the .env file and edit:

    DB_CONNECTION=mysql

    DB_HOST=127.0.0.1

    DB_PORT=3306

    DB_DATABASE= // db Name

    DB_USERNAME= // db Username

    DB_PASSWORD= // db Password

    Run below commands:

    php artisan config:cache
    
    php artisan migrate
    

    I hope this will help you

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search