用户 'root'@'localhost' 的访问被拒绝(使用密码:YES) - 没有权限?

Access Denied for User #39;root#39;@#39;localhost#39; (using password: YES) - No Privileges?(用户 root@localhost 的访问被拒绝(使用密码:YES) - 没有权限?)

本文介绍了用户 'root'@'localhost' 的访问被拒绝(使用密码:YES) - 没有权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不断收到此错误.

我正在使用 mySQL Workbench,我发现 root 的架构权限为空.根本没有特权.

I am using mySQL Workbench and from what I am finding is that root's schema privileges are null. There are no privileges at all.

我在使用我的服务器的平台上遇到了问题,这是一个突然的问题.

I am having troubles across platforms that my server is used for and this has been all of a sudden issue.

root@127.0.0.1 显然有很多访问权限,但我以该身份登录,但无论如何它只是分配给 localhost - localhost 没有权限.

root@127.0.0.1 apparently has a lot of access but I am logged in as that, but it just assigns to localhost anyways - localhost has no privileges.

我做过一些事情,比如FLUSH HOSTSFLUSH PRIVILEGES等但没有发现从那个或互联网上取得成功.

I have done a few things like FLUSH HOSTS, FLUSH PRIVILEGES, etc but have found no success from that or the internet.

我怎样才能获得 root 的访问权限?我觉得这令人沮丧,因为当我环顾四周时,人们希望你有访问权限",但我没有访问权限,所以我无法进入命令行或任何东西,也不能GRANT 自己任何东西.

How can I get root its access back? I find this frustrating because when I look around people expect you to "have access" but I don't have access so I can't go into command line or anything and GRANT myself anything.

运行 SHOW GRANTS FOR root 时,这是我得到的回报:

When running SHOW GRANTS FOR root this is what I get in return:

错误代码:1141.没有为用户root"定义这样的授权主机'%'

Error Code: 1141. There is no such grant defined for user 'root' on host '%'

推荐答案

使用 重置 root 密码的说明 - 但不是重置 root 密码,我们将强行将记录插入到 mysql.user 表中

Use the instructions for resetting the root password - but instead of resetting the root password, we'll going to forcefully INSERT a record into the mysql.user table

在init文件中,改用这个

In the init file, use this instead

INSERT INTO mysql.user (Host, User, Password) VALUES ('%', 'root', password('YOURPASSWORD'));
GRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION;

这篇关于用户 'root'@'localhost' 的访问被拒绝(使用密码:YES) - 没有权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:用户 'root'@'localhost' 的访问被拒绝(使用密码:YES) - 没有权限?

基础教程推荐