I executed {code ...} error {code ...} I found the information online, right. env and database. PHP file configuration is correct {code ...} the following configuration is modified as follows: 127.0.0.10.0.0.0 is invalid {code ...} in addition, this command is invalid {code ...} execute
php artisan migrate
Error
[PDOException] SQLSTATE[HY000] [2002] No such file or directory
I searched for information online.envAnddatabase.phpFile configuration is normal
DB_HOST=localhostDB_DATABASE=homesteadDB_USERNAME=homesteadDB_PASSWORD=secret
Modify the following configurations as follows:127.0.0.1 0.0.0.0Invalid
DB_HOST=localhost
In addition, this command is invalid.
php artisan migrate --env=production
Reply content:
Execute
php artisan migrate
Error
[PDOException] SQLSTATE[HY000] [2002] No such file or directory
I searched for information online.envAnddatabase.phpFile configuration is normal
DB_HOST=localhostDB_DATABASE=homesteadDB_USERNAME=homesteadDB_PASSWORD=secret
Modify the following configurations as follows:127.0.0.1 0.0.0.0Invalid
DB_HOST=localhost
In addition, this command is invalid.
php artisan migrate --env=production
Resolved
Modifydatabase.php
'host' => env('DB_HOST', 'localhost') . ('homestead' == gethostname() ? null : ':33060'),
Update:
I am running commands on the Mac host, so you need to specify the ing port number: 33060
If you run the command directly on the homestead Vm, you do not need to specify it because the default value is 3306.