skip to Main Content

I try to run xampp on window 7. My php version is php 7.3.2.
After run composer install, I run php artisan migrate.

My error is:

SQLSTATE[HY000] [1044] Access denied for user ”@’localhost’ to database ‘inventory’ (SQL: select * from information
_schema.tables where table_schema = inventory and table_name = migrations)

and

SQLSTATE[HY000] [1044] Access denied for user ”@’localhost’ to database ‘inventory’

2

Answers


  1. You forgot to set DB_USERNAME= in the .env file, so you’re getting this error:

    SQLSTATE[HY000] [1044] Access denied for user ”@’localhost’ to
    database ‘inventory’

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

    DB_USERNAME=         //Your Database Username           
    

    DB_USERNAME should be set to root if you do not have a default username in the installation time

    After changes of .env enter this command in your terminal for clear cache:php artisan config:cache


    NOTE: If you’re still getting error

    Check your database configuration with tinker.

    php artisan tinker
    

    then write this will give you whole configuration check is it right or not.

    >>config('database')
    
    Login or Signup to reply.
  2. Specify your DB configuration as per below:
    also make sure you have created a database.

    DB_DATABASE= db_name
    DB_USERNAME= user_name
    DB_PASSWORD= password
    

    Make sure your xampp is running.

    Then after editing the .env file run below command.

    php artisan config:clear
    

    and then run,

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