今天在研究数据库的时候不小心吧root用户的权限全给关了。这就尴尬了。

找了半天的解决方案。

如果你的用grant all 无法设定某个用户的权限可以试试这个方法。

1停止mysql服务器。使用skip-grant-tables 登陆。 mysqld_safe --skip-grant-tables & mysql -uroot

2 手动修改用户的权限。使其可以设置权限。

UPDATE mysql.user SET Grant_priv='Y', Super_priv='Y' WHERE User='root';
  • 1

3 刷新缓冲区

FLUSH PRIVILEGES;
  • 1

然后你就可以使用

GRANT ALL ON *.* TO 'root'@'localhost';
  • 1

可以使用如下命令产看用户权限

select * from mysql.user\G
  • 1

\G会竖着排列

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
  • 2022-12-23
  • 2022-12-23
  • 2022-02-10
猜你喜欢
  • 2021-10-07
  • 2021-08-28
  • 2022-01-10
  • 2022-12-23
  • 2021-10-19
  • 2021-12-04
  • 2022-12-23
相关资源
相似解决方案