mercredi 1 mars 2017

loacalhost vs127.0.0.1 in .env file in laravel

I am very new to Laravel. I am using Homestead. When I try to any migration using php artisan migrate command I have to use DB_HOST=127.0.0.1 in the .env file. If I use localhost instead of 127.0.0.1 if get the following error: [PDOException]
SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)

Whereas, when I am using eloquent functionality in models and trying to populate the database I have to change DB_HOST in .env file to localhost i.e. DB_HOST=localhost, if not then I get the following error: PDOException in Connector.php line 55: SQLSTATE[HY000] [2002] Connection refused

I have no idea about this. I am all confused. Where am I going wrong??



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire