MySQL身份验证错误的原因:“用户'xxx'@'yyy'的访问被拒绝"? [英] Reasons for MySQL authentication error: "Access denied for user 'xxx'@'yyy'"?

查看:80
本文介绍了MySQL身份验证错误的原因:“用户'xxx'@'yyy'的访问被拒绝"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当尝试使用PHP-mysqli访问数据库时,MySQL给出错误Access denied for user 'xxx'@'yyy'的错误,使用命令行mysql工具使用完全相同的用户名,密码,套接字,数据库和主机时,可能会出现错误Access denied for user 'xxx'@'yyy' ?
更新:
mysql.user表中确实有3个用户,每个用户使用不同的主机(但具有相同的哈希密码),一个用户设置为localhost,一个用户设置为127.0.0.1,另一个用户设置为计算机的主机名.删除其中两个并将第三个主机更改为%"仅具有一种效果:现在也使用命令行工具拒绝了访问. 我确实做了

What possible reasons could exist for MySQL giving the error "Access denied for user 'xxx'@'yyy'" when trying to access a database using PHP-mysqli and working fine when using the command-line mysql tool with exactly the same username, password, socket, database and host?
Update:
There were indeed three users in the mysql.user table, each one with a different host (but with the same hashed password), one was set to localhost, one to 127.0.0.1 and one to the machine’s host name. Deleting two of them and changing the host of the third to "%" had only one effect: now the access is denied using the command-line tool also. I did do a

 select user();

在命令行之前,它会产生与php中相同的xxx @ yyy.

before that in the command line and it yielded the same xxx@yyy that were denied in php.

推荐答案

以防万一仍然有人感兴趣:我从未解决过这个特殊问题.看来问题出在我运行MySQL的硬件上.从那以后,我再也没有见过像这样的东西了.

In case anyone’s still interested: I never did solve this particular problem. It really seems like the problem was with the hardware I was running MySQL on. I’ve never seen anything remotely like it since.

这篇关于MySQL身份验证错误的原因:“用户'xxx'@'yyy'的访问被拒绝"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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