简体   繁体   English

Laravel SQLSTATE [HY000] [2002]连接被拒绝| 锻造 AWS

[英]Laravel SQLSTATE[HY000] [2002] Connection refused | Forge | AWS

  1. I connected github repo to the forge (forge connected to AWS) and installed nova 我将github存储库连接到伪造(伪造连接到AWS)并安装了nova
  2. Deployed it (so now it has been migrated by forge script) and it opens by default with URL - 34.201.135.133 部署了它(因此现在已经通过伪造脚本进行了迁移),并且默认情况下使用URL-34.201.135.133打开
  3. Database connected to GUI (sequel pro) 数据库连接到GUI(Sequel Pro)
  4. I've made changes and want to migrate, but it shows message 我进行了更改并想要迁移,但是它显示了消息

在此处输入图片说明

My .env is 我的.env是

APP_NAME=Laravel
APP_ENV=production
APP_KEY=(copied from forge's .env)
APP_DEBUG=false
APP_URL=http://localhost`

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=forge
DB_USERNAME=forge
DB_PASSWORD=(copied from forge's .env)

Is that correct that I'm doing it from mac terminal just by php artisan migrate? 我是通过php artisan migration从mac终端执行此操作的吗? Or I have to do this operation after SSHing to server (if yes - how?). 或者,我必须在SSH到服务器后执行此操作(如果是,怎么办?)。

From the above error, it seems, one of the following value is incorrect in environment settings/ .env file: 从以上错误看来,以下值之一在环境设置/ .env文件中不正确:

  1. Database Name 数据库名称
  2. Database User 数据库用户
  3. Database Password 数据库密码
  4. Database host 数据库主机

Please note that Database host should point to the Private IP address of your AWS instance instead of localhost or public IP address. 请注意,数据库主机应指向您的AWS实例的私有IP地址,而不是本地主机或公共IP地址。

Also command needs to be run over SSH 另外命令需要通过SSH运行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM