用户“root”的访问被拒绝。 PHP/MYSQL/XAMPP

发布于 2024-12-06 12:35:46 字数 603 浏览 0 评论 0原文

我已经使用 XAMPP 一段时间了,但今天早上似乎出了点问题。 我使用 XP 和 XAMPP 5.3.5。

我在家开发,用我的另一台电脑作为服务器。在 XAMPP 上运行 PHP/APACHE/MYSQL。 我正在使用 phpMyAdmin 来管理我的数据库。 我注意到我的网页响应速度不太快,会滞后并返回有关无法连接到数据库的错误。 (我丢失了该错误消息,我尝试了太多次)。

  1. 我最终更改了 phpMyAdmin 内的 root 安全密码,
  2. 更改了 config.inc.php 的相同密码,

但我仍然收到此消息:

警告:mysql_connect()[function.mysql-connect]:用户'root'@'的访问被拒绝第 5 行 C:\xampp\htdocs\MyProject\includes\connection.php 中的 localhost'(使用密码:NO) 数据库连接失败:用户“root”@“localhost”访问被拒绝(使用密码:NO)。

为什么显示“使用密码:否”?我确实为 root 创建了密码,也为目录创建了密码,并且还更新了 config.inc.php 我该如何从中恢复过来,似乎一个工作日已经过去了。 谢谢 !!!

I have been using XAMPP for a while now, but this morning seems like something kinda went wrong.
I am using XP with XAMPP 5.3.5.

I develop at home, and I use my other computer as a server. running PHP/APACHE/MYSQL on XAMPP.
I am using phpMyAdmin to manage my db.
I noticed that my webpage was not responding too quickly, would lag and return an error about not being able to connect to the DB. (I lost that error message, I tried too many times).

  1. I ended up changing the root security password inside phpMyAdmin
  2. changed the config.inc.php for that very same password

Still I get this message:

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: NO) in C:\xampp\htdocs\MyProject\includes\connection.php on line 5
Database connection failed: Access denied for user 'root'@'localhost' (using password: NO).

Why does it say "using password: NO" ? I did create a password for root, and also for the directory, and also updated config.inc.php
How do I recover from this, seems like a work day has passed by.
Thanks !!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

西瓜 2024-12-13 12:35:46

规则 #1:不要使用 root 进行应用程序编程。

尝试使用 mysql 客户端和 root 密码登录数据库。如果这不起作用,您可能需要重置 root 密码。 MySql 文档对此有说明。

Rule #1: DO NOT USE root for application programming.

Try logging onto the database using the mysql client and your root password. If that doesn't work, you may have to reset your root password. The MySql docs have instructions for that.

奈何桥上唱咆哮 2024-12-13 12:35:46

您是否尝试过使用 root 作为用户名密码?

Have you tried with root as both the username and password?

┼── 2024-12-13 12:35:46

您可以尝试在浏览器 cookie 中搜索“localhost”。然后,您可以删除任何与 pma 相关的项目,因为它们可能包含过时的凭据

you might try searching your browser cookies for "localhost". you could then delete any pma related items as they may contain outdated credentials

沫尐诺 2024-12-13 12:35:46
Simply to add the password or remove the existing one
1. Go to your root of phpmyadmin. Select the user tab.
2. Select the user that you assign.
3. Click on Edit Privileges.     
4. Find on login information fieldset
5. Adjust the password you wanna set

这可能有帮助

Simply to add the password or remove the existing one
1. Go to your root of phpmyadmin. Select the user tab.
2. Select the user that you assign.
3. Click on Edit Privileges.     
4. Find on login information fieldset
5. Adjust the password you wanna set

That's it may helpful

薄凉少年不暖心 2024-12-13 12:35:46

我知道这听起来很奇怪,但在我在 Win7 上新安装的 Xampp 堆栈中,我在“用户名”字段中输入“127.0.0.1”,并将“密码”留空。它直接带我到了控制面板!

I know this sounds sounds bizarre, but on my new installation on Win7, using the Xampp stack, I typed '127.0.0.1' in 'username' field, and left 'password' blank. It took me straight to the control panel!

南街九尾狐 2024-12-13 12:35:46

XAMPP 有一个奇怪的默认配置,接受来自任何主机的任何用户。因此,第一次打开 phpMyAdmin 时只需使用 localhost 作为服务器,不要输入任何用户/密码。进入后,删除两个“任何”用户帐户并创建您自己的帐户。

XAMPP has a weird default configuration and accepts any user from any host. So the first time you open phpMyAdmin just use localhost for the server and don't type any user/pass. Once you're in delete both "Any" user accounts and create your own.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文