简体   繁体   English

设置mysql数据库时出现问题

[英]Issues setting up mysql database

I have a php script that (in theory) connects to a database. 我有一个PHP脚本(理论上)连接到数据库。 The issue is that when I try to test my script in http://phptester.net/ it tells me that said credentials are wrong. 问题是,当我尝试在http://phptester.net/中测试脚本时,它告诉我所说的凭证是错误的。

在此处输入图片说明

I am fairly new to this whole php and mysql set up but this is what I know thus far: 我对整个php和mysql的设置还很陌生,但这是到目前为止我所知道的:

  1. I have a domain registered @ godaddy.com with hosting (obviously) 我有一个域名托管的@ godaddy.com(显然)
  2. I used their Database Interface to create my first database (I called it myProfile) 我使用他们的数据库接口创建了我的第一个数据库(我称其为myProfile)
  3. I also used their interface to create a user and added that user to the database with all its privileges 我还使用了他们的界面来创建一个用户,并将该用户以其所有特权添加到数据库中。

Here is where the issue lays: I go to Databases link in my cPanel page and see my database WITH my user and you can see its privileges: 这是问题所在:我转到cPanel页面中的Databases链接,与我的用户一起查看我的数据库,您可以看到它的特权:

在此处输入图片说明

在此处输入图片说明

Now, I go to phpMyAdmin in godaddy and I find that there is indeed the myProfile database but I can't find the user I created. 现在,我在godaddy中转到phpMyAdmin ,发现确实存在myProfile数据库,但是找不到我创建的用户。

在此处输入图片说明

I see a user that I never ever seen before but no matter what I do in phpMyAdmin I can't ADD, CREATE, GRANT PRIVILEGES or do anything user related. 我看到一个我从未见过的用户,但是无论我在phpMyAdmin中做什么,我都无法添加,创建,授予特权或执行任何与用户相关的操作。 I even tried looking up in a query to see if the one I created on the interface shows up. 我什至尝试在查询中查找以查看我在界面上创建的查询是否出现。 But nothing works! 但是什么都行不通!

在此处输入图片说明

在此处输入图片说明

Can anyone help me with this conundrum? 有人可以帮助我解决这个难题吗?

Your host likely doesn't accept incoming connections from anywhere but 127.0.0.1. 您的主机可能不接受127.0.0.1之外的任何地方的传入连接。 Even if it does, it shouldn't accept those requests unless they're encrypted. 即使是这样,它也不应接受这些请求,除非已对其进行加密。

Therefore, PHPTester.net fails - not by any deficiency, just because Godaddy is using default/recommended/smart security settings to disallow these remote connection attempts. 因此,PHPTester.net失败-并非毫无缺陷,只是因为Godaddy使用默认/推荐/智能安全设置来禁止这些远程连接尝试。

Why not try testing the database connection by opening a browser window pointed at the connection page you're showing us? 为什么不通过打开指向您向我们显示的连接页面的浏览器窗口来尝试测试数据库连接?

I dont really get lucas's answer but after creating a user you have to explicitely assign the user to the database. 我并没有真正得到lucas的答案,但是在创建用户之后,您必须明确地将该用户分配给数据库。

这是从CPANEL->数据库-> MYSQL数据库完成的

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

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