简体   繁体   English

aws ec2 ubuntu ami 托管 mysql 实例连接被拒绝错误

[英]aws ec2 ubuntu ami hosted mysql instance connection denied error

aws ec2 setup details: ubuntu18.04 ami, mysql8 installed and user created with native password aws ec2 设置详细信息:ubuntu18.04 ami,已安装 mysql8 并使用本机密码创建用户
the my sql db instance allows connection from workbench on laptop我的 sql 数据库实例允许从笔记本电脑上的工作台连接
have a nodejs app hosted on heroku connecting same db and it works有一个 nodejs 应用程序托管在 heroku 连接同一个数据库,它工作
hosted the same nodejs app on that same ec2 instance but testing with postman for that gives error在同一个 ec2 实例上托管同一个 nodejs 应用程序,但使用 postman 进行测试会给出错误
host for db in node app: public ip of ec2节点应用程序中的数据库主机:ec2 的 public ip
user: mysqluser用户:mysqluser
password:mysqlpassword密码:mysql密码
port:3306端口:3306

security group for ec2 allows every connection to nodejs app on port 3001 and mysql port 3306 ec2 的安全组允许每个连接到端口 3001 和 mysql 端口 3306 上的 nodejs 应用程序

connection string for nodejs app in heroku and ec2 is same and have also tried using localhost for host in ec2 nodejs app heroku 和 ec2 中 nodejs 应用程序的连接字符串相同,并且还尝试在 ec2 nodejs 应用程序中使用 localhost 作为主机

error faced "Access denied for user 'ubuntu'@'localhost' (using password: YES)"面临错误“拒绝用户'ubuntu'@'localhost'的访问(使用密码:YES)”
also error faced "Client does not support authentication protocol requested by server; consider upgrading MySQL client"还面临错误“客户端不支持服务器请求的身份验证协议;考虑升级 MySQL 客户端”
this authentication error happens if host is changed from localhost to public ip of ec2如果主机从 localhost 更改为 ec2 的 public ip,则会发生此身份验证错误
this user is ubuntu even after changing user to mysql user in connection string即使在连接字符串中将用户更改为 mysql 用户后,此用户仍为 ubuntu
this error only happens for nodejs app hosted on same ec2 instance with mysqldb doesnt happen for workbench or heroku nodejs app此错误仅发生在与 mysqldb 相同的 ec2 实例上托管的 nodejs 应用程序不会发生在 workbench 或 heroku nodejs 应用程序上

this is for anyone facing same issue it was solved after using sudo npm start didnt include sudo before这适用于遇到相同问题的任何人,在使用 sudo npm 开始之前未包含 sudo 后已解决

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

相关问题 错误 404 页面显示而不是 wordpress 管理面板(网站托管在 AWS EC2 实例、Ubuntu 上) - Error 404 page showing instead of wordpress admin panel ( Website Hosted on AWS EC2 instance, Ubuntu) 如何与 AWS EC2 实例建立连接并找到托管文件 - How to make connection with AWS EC2 instance and locate the hosted files AWS EC2 实例连接在浏览器中被拒绝 - AWS EC2 Instance Connection Refused in browser AWS EC2 实例连接问题 - AWS EC2 instance connection issue EC2 实例上托管的 Laravel 项目的站点部署连接被拒绝 - Site deployment connection refused for Laravel Project hosted on EC2 instance 如何与aws上的ec2实例建立安全连接 - How to make a secure connection to ec2 instance on aws AWS 连接超时 + EC2 实例连接不工作 - AWS Connection timeout + EC2 Instance Connect not working 托管在 EC2 中的 Jenkins 与 EC2 工作人员失去联系 - Jenkins hosted in EC2 losing connection with EC2 workers 在 ubuntu ec2 实例中拒绝访问用户时如何重置 root 密码 - How to reset root password when denied access to user in ubuntu ec2 instance 来自带有 Kube.netes 集群的自定义 AMI 的 EC2 实例无法正常工作 - EC2 Instance from custom AMI with Kubernetes cluster in it not working
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM