简体   繁体   English

无法连接到 GoDaddy 上的 MySQL 数据库

[英]Cannot connect to MySQL database on GoDaddy

I have been trying to connect to my database but can't connect.我一直在尝试连接到我的数据库,但无法连接。 Just 3 days ago I purchased domain and hosting plan on GoDaddy.就在 3 天前,我在 GoDaddy 上购买了域名和托管计划。 First thing I did was I downloaded my database from another account and tried to import to my new account.我做的第一件事是从另一个帐户下载我的数据库并尝试导入到我的新帐户。 It gave me an error that database was not found to upload my table.它给了我一个错误,即找不到数据库来上传我的表。 So I created new database using GoDaddy's cPanel which allows us to create databases.所以我使用 GoDaddy 的 cPanel 创建了新的数据库,它允许我们创建数据库。 Then I created users and added privileges to them.然后我创建了用户并为他们添加了权限。 It clearly shows, in the below pictures, that user was created and added to database.在下面的图片中,它清楚地显示了该用户已创建并添加到数据库中。 But when I try to connect to my database by PHP script using pdo connection, it throw the below error.但是当我尝试使用 pdo 连接通过 PHP 脚本连接到我的数据库时,它会抛出以下错误。


[06-Aug-2018 06:15:17 UTC] PHP Fatal error:  Uncaught PDOException: SQLSTATE[28000] [1045] Access denied for user 'cajetanF'@'ip-160-153-129-239.ip.secureserver.net' (using password: YES) in /home/ry91p8weag4x/public_html/Conn.php:9
Stack trace:
# 0 /home/ry91p8weag4x/public_html/Conn.php(9): PDO->__construct('mysql:host=sgva...', 'cajetanF', 'Cajetan')
# 1 {main}
  thrown in /home/ry91p8weag4x/public_html/Conn.php on line 9

I am attached pictures below of the database.我在下面附上了数据库的图片。 There is an auto user given my phpMyAdmin I guess who has full access but I just can't understand how to connect using that, I tried connecting with that user but can't.有一个自动用户给了我的 phpMyAdmin 我猜谁拥有完全访问权限,但我只是不明白如何使用它进行连接,我尝试与该用户连接但不能。 I just want to know what might be the password for that account to connect to my database.我只想知道该帐户连接到我的数据库的密码可能是什么。 在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

Your GRANT is giving permission to the user@ localhost but the error message is telling you that they are @ ip-160-153-129-239.ip.secureserver.net .您的 GRANT 正在向 user@ localhost授予权限,但错误消息告诉您他们是 @ ip-160-153-129-239.ip.secureserver.net

You have to give permission for the user to connect from the place they are connecting from.您必须授予用户从他们连接的地方连接的权限。

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

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