用户“root”的访问被拒绝。 PHP/MYSQL/XAMPP
我已经使用 XAMPP 一段时间了,但今天早上似乎出了点问题。 我使用 XP 和 XAMPP 5.3.5。
我在家开发,用我的另一台电脑作为服务器。在 XAMPP 上运行 PHP/APACHE/MYSQL。 我正在使用 phpMyAdmin 来管理我的数据库。 我注意到我的网页响应速度不太快,会滞后并返回有关无法连接到数据库的错误。 (我丢失了该错误消息,我尝试了太多次)。
- 我最终更改了 phpMyAdmin 内的 root 安全密码,
- 更改了 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).
- I ended up changing the root security password inside phpMyAdmin
- 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
规则 #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.
您是否尝试过使用
root
作为用户名和密码?Have you tried with
root
as both the username and password?您可以尝试在浏览器 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
这可能有帮助
That's it may helpful
我知道这听起来很奇怪,但在我在 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!
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.