所以我想将现有的 Laravel 项目部署到我的 digital ocean VPS 中 我用了this tutorial并且我成功上传了我的网站。
我的 .env
文件是:
APP_ENV=local
APP_KEY=my app key
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=my ip
DB_PORT=3306
DB_DATABASE=form
DB_USERNAME=root
DB_PASSWORD=my pass
但问题是:我使用 MySQL 并创建并运行
php artisan migrate
并得到这些错误:
[Illuminate\Database\QueryException] SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = form and table_name = migrations)
和
[PDOException] SQLSTATE[HY000] [2002] Connection refused
最佳答案
在您的 .env
文件中,将 DB_HOST
从 127.0.0.1
更改为 localhost
关于php - Laravel SQLSTATE[HY000] [2002] 连接被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41225720/