Search code examples
phplaravellaravel-artisanmigrate

Can't php artisan migrate


I was having a problem, did you know how to fix it? I'm using a web hosting server and trying to do that php artisan migrate

Exception trace:

1 PDOException::("SQLSTATE[HY000] [1045] Access denied for user 'u739920537_root'@'*********' (using password: YES)")

/Users/edvinasvalentinovicius/Desktop/testas/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70

2 PDO::__construct("mysql:host=******;port=3306;dbname=u739920537_laravel", "u739920537_root", "*******", [])

/Users/edvinasvalentinovicius/Desktop/testas/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70


Solution

  • Open your .env file and set the correct database configuration(Link):

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

    Anytime you change a .env file you will need a clear cache: php artisan config:cache