mysql 密码在终端中有效,但在 phpMyAdmin 中无效?
我可以通过终端登录 mysql,使用
mysql -u root -p
提示:
Enter password:
当我输入密码时,我得到:
Welcome to the MySQL monitor....
但是,当我尝试使用相同的用户名/密码组合进入 phpMyAdmin 时,我得到错误:
#2002 Cannot log in to the MySQL server
注意:我正在使用 Snow Leopard
I can log in to mysql through Terminal using
mysql -u root -p
I'm prompted with:
Enter password:
When I enter the password I get:
Welcome to the MySQL monitor....
However, when I try to user the same username/password combination into phpMyAdmin I get the rror:
#2002 Cannot log in to the MySQL server
Note: I am using Snow Leopard
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为要么在远程主机上默认禁用root(考虑到你的mysql服务器和http服务器位于不同的主机上),要么远程root密码与本地主机上的密码不同(同样的原因)。
创建一个新的管理员用户比远程使用 root 更好(新用户名显然不太容易猜到)。
I think that either the root is disabled by default on remote host (considering that your mysql server and your http server are on different host), or the remote root password is different from the one on localhost (same reason).
It would be a way better to create a new admin user rather than using root remotely (the new username is obviously less easy to guess).
因为我在 Snow Leopard 中,所以我必须执行以下操作。
打开终端
并将 var/mysql/mysql.sock 替换为以下内容:
然后在终端中
Because I am in Snow Leopard, I had to do the following.
Open Terminal
And replace var/mysql/mysql.sock with the following:
Then in Terminal
当您的数据库中没有为 phpMyAdmin 配置 controluser 时,可能会发生这种情况。
默认情况下,配置文件如下所示。
您还可以通过以下查询检查现有的数据库用户:
希望它会有所帮助。
It might happen when, there is no controluser configured for phpMyAdmin in your database.
By default it is like below from config file.
You can also check existing database users by following query:
Wish it will help.