我试图让Laravel在远程服务器上工作。但当我运行“php artisan migrate”命令时,它会响应:
[PDOException]
SQLSTATE[HY000] [2002] Connection refused
我谷歌寻求解决方案,到目前为止我尝试过:
.ENV
APP_ENV=local
APP_DEBUG=true
APP_KEY=base64:[secret]=
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=daniel
DB_USERNAME=daniel
DB_PASSWORD=4K^2N(h}%V&S
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
database.php中
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'daniel'),
'username' => env('DB_USERNAME', 'daniel'),
'password' => env('DB_PASSWORD', '4K^2N(h}%V&S'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],