讨论数量:
目前我在虚拟机中运行 php artisan tink,DB_HOST 设置的是 localhost 端口号一直是 33060。DB_HOST 是 192.168.10.10 时出错。在本机中连接虚拟机中的数据库端口号用的是 3306。然后参照:
1:Forum > Homestead - SQLSTATE[HY000] [2002] Connection refused
answer1:Change 127.0.0.1 to localhost and it should work.
answer2:
If you set the DB_HOST to the APP_URL then it will always work, on your dev machine and the VM so like this:
APP_URL=http://homestead.app
DB_CONNECTION=mysql
DB_HOST=homestead.app
DB_PORT=3306
DB_DATABASE=#
DB_USERNAME=homestead
DB_PASSWORD=secret
设置成与 URL 一致的也行。没有试 php artisan migrate 命令。
推荐文章: