简体   繁体   English

如何重设MySQL root用户密码和特权

[英]How to reset MySQL root user password and privileges

I assigned a password to the root MySQL user in XAMPP some times ago. 之前,我为XAMPP中的MySQL根用户分配了密码。 I recently tried to undo that and give it no password but it's not working. 我最近尝试撤消该操作,不提供密码,但无法正常工作。

I tried setting the password to an empty string using mysqld --skip-grant-tables and then using the mysql command line directly. 我尝试使用mysqld --skip-grant-tables ,然后直接使用mysql命令行将密码设置为空字符串。 It looks like it works, the root user no longer has a password, however if I login in PhpMyAdmin I cannot see any of my databases, only an "information_schema" and a "test" database. 看起来像这样,root用户不再具有密码,但是,如果我登录PhpMyAdmin,则看不到任何数据库,只有“ information_schema”和“ test”数据库。 If I look at the User tab, it seems to have all the privileges though: 如果查看“用户”选项卡,它似乎具有所有特权:

在此处输入图片说明

Any suggestion on how to fix this issue? 关于如何解决此问题的任何建议?

Note: I checked with the command line, all my databases and tables are still there, I just cannot see them in PHPMyAdmin. 注意:我用命令行检查过,我所有的数据库和表仍然存在,我只是在PHPMyAdmin中看不到它们。

Try removing the anonymous user who is allowed to connect from any host. 尝试删除允许从任何主机进行连接的匿名用户。 My feeling is that that row is taking precidence over the row for root when MySQL validates the login. 我的感觉是,当MySQL验证登录名时,该行优先于root行。

If you have removed that Anonymous user and the issue still occurs, try setting a password to root and the host to localhost then connect again. 如果您删除了该匿名用户并且仍然出现此问题,请尝试将密码设置为root,将主机设置为localhost然后再次连接。

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

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