SQLSTATE [HY000] 连接仅在使用laravel 5的工匠中被拒绝
I'm running a vagrant box and with laravel 5. For some reason when running
php artisan it throws the following error:
SQLSTATE[HY000]  Connection refused
This happens when I have my
host set to
127.0.0.1. When using
localhost I get
File or directory not found.
The strange part is that the website itself works fine in the browser. This only happens in
I also tried changing ports between
I did the following in the laravel
$pdo = new PDO('mysql:host=127.0.0.1;dbname=mydb','root','mypassword'); var_dump(get_class_methods($pdo)); die();
and it worked fine. Inside the
Connector.php file I checked the variables being passed to the
PDO constructor and they were identical to what I filled in above. What is going on?