Laravel SQLSTATE [HY000] [2002]连接被拒绝 [英] Laravel SQLSTATE[HY000] [2002] Connection refused
问题描述
所以我想将现有的laravel项目部署到我的digitalocean vps中 我使用了此 tut,并且我成功上传了我的网站
so I want to deploy my existing laravel porject into my digitalocean vps I user this tut and I upload my site successfully
我的环境文件也是
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
并得到了这些错误
有什么问题
I used mysql and created and ran php artisan migrate
and got these errors
what is the problem
[Illuminate \ Database \ QueryException] SQLSTATE [HY000] [2002]连接被拒绝(SQL:从information_s中选择* chema.tables,其中table_schema =表格,table_name =迁移)
[Illuminate\Database\QueryException] SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_s chema.tables where table_schema = form and table_name = migrations)
和
[PDOException] SQLSTATE [HY000] [2002]连接被拒绝
[PDOException] SQLSTATE[HY000] [2002] Connection refused
推荐答案
在您的.env
文件中,将DB_HOST
从127.0.0.1
更改为localhost
In your .env
file, change DB_HOST
from 127.0.0.1
to localhost
这篇关于Laravel SQLSTATE [HY000] [2002]连接被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!