[PDOException]-SQLSTATE [HY000] [1045]用户'root'@'ip'的访问被拒绝(使用密码:是) [英] [PDOException]- SQLSTATE[HY000] [1045] Access denied for user 'root'@'ip' (using password: YES)

查看:1471
本文介绍了[PDOException]-SQLSTATE [HY000] [1045]用户'root'@'ip'的访问被拒绝(使用密码:是)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过ssh连接到AWS,以便迁移一些文件.我使用以下命令成功连接:

I am trying to connect to AWS through ssh in order to migrate some files. I connected successfully using the following command:

ssh -i ~/Downloads/key.pem ec2-user@myuser

然后,我尝试运行以下命令:

Then, I tried to run the following :

php artisan migrate

我得到了以下内容:

[PDOException]                                                               
  SQLSTATE[HY000] [1045] Access denied for user 'user'@'ip' (using password: YES)

是什么使我无法访问我的数据库以进行迁移?!

What could be preventing me from accessing my DB in order to migrate?!

推荐答案

当您连接到AWS时,您将通过SSH连接到虚拟化Linux服务器上的unix shell帐户.

When you connect to AWS you're connecting to a unix shell account on a virtualize linux server via SSH.

在此虚拟服务器(或其他服务器)上,您正在运行数据库应用程序的实例.此数据库应用程序也是也是服务器.但是,它具有自己的凭证系统.当您看到此错误消息

On this virtual server (or maybe another server), you're running an instance of a database application. This database application is also a server. However, it has its own credential system. When you see this error message

[PDOException]
SQLSTATE [HY000] [1045]对用户'user'@'ip'的访问被拒绝(使用密码:是)

[PDOException]
SQLSTATE[HY000] [1045] Access denied for user 'user'@'ip' (using password: YES)

这是PHP/Laravel告诉您

This is PHP/Laravel telling you

嘿,我尝试使用app/config/database.php文件中的凭据连接到数据库,但是服务器告诉我那些凭据无效.

Hey, I tried to connect to the database with the credentials in my app/config/database.php file, but the server told me those credentials were invalid.

换句话说,您为"user"配置的密码与实际密码不匹配,或者"user"帐户无权从IP地址访问数据库服务(MySQL?) PHP正在运行.

In other words, the password you configured for "user" didn't match the actual password, or the "user" account isn't authorized to access the database service (MySQL?) from the IP address PHP is running.

使用正确的数据库凭据,您的错误将消失.使用命令行mysql程序测试您的数据库凭据.

Use the correct database credentials, and your error will go away. Use the command line mysql program to test your database credentials.

希望这足以让您使用Google进行正确的搜索! :)

Hopefully that's enough to get you Google-ing for the right thing! :)

这篇关于[PDOException]-SQLSTATE [HY000] [1045]用户'root'@'ip'的访问被拒绝(使用密码:是)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆