Access denied for user 'homestead'@'localhost' (using password: YES)

前端 未结 29 1722
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-27 10:23

I\'m on a Mac OS Yosemite using Laravel 5.0.

While in my local environment, I run php artisan migrate I keep getting :

29条回答
  •  迷失自我
    2020-11-27 10:39

    I had the same issue using SQLite. My problem was that DB_DATABASE was pointing to the wrong file location.

    Create the sqlite file with the touch command and output the file path using php artisan tinker.

    $ touch database/database.sqlite
    $ php artisan tinker
    Psy Shell v0.8.0 (PHP 5.6.27 — cli) by Justin Hileman
    >>> database_path(‘database.sqlite’)
    => "/Users/connorleech/Projects/laravel-5-rest-api/database/database.sqlite"
    

    Then output that exact path to the DB_DATABASE variable.

    DB_CONNECTION=sqlite
    DB_HOST=127.0.0.1
    DB_PORT=3306
    DB_DATABASE=/Users/connorleech/Projects/laravel-5-rest-api/database/database.sqlite
    DB_USERNAME=homestead
    DB_PASSWORD=secret
    

    Without the correct path you will get the access denied error

提交回复
热议问题