简体   繁体   English

如何在mysql中为用户授予禁用权限

[英]How to grant disabled permissions on a user in mysql

For some testing, I had unchecked INSERT, UPDATE and DELETE permissions on Data in phpMyAdmin. 对于某些测试,我在phpMyAdmin中对Data进行了未选中的INSERT,UPDATE和DELETE权限。

previleges

Now when I tried to enable those permissions again, am getting follow error: 现在,当我尝试再次启用这些权限时,出现以下错误:

没有权限

Can anyone please guide me how to enable the privileges again? 任何人都可以指导我如何再次启用权限?

I was facing this problem in XAMPP on Mac. 我在Mac上的XAMPP中遇到了这个问题。 There are many solutions provided in various posts, but no one was completely fixing my problem. 各个帖子中提供了许多解决方案,但没有人完全解决我的问题。 So I am updating the answer, as it may help someone else to fix their problem. 所以我正在更新答案,因为它可以帮助其他人解决他们的问题。 Steps followed are: 遵循的步骤是:

  1. Stop mysql server in XAMPP sudo /Applications/XAMPP/xamppfiles/bin/mysql.server stop 在XAMPP中停止mysql服务器sudo /Applications/XAMPP/xamppfiles/bin/mysql.server stop

  2. Edit my.cnf to skip grant privileges to user sudo vi /Applications/XAMPP/xamppfiles/etc/my.cnf 编辑my.cnf以跳过用户sudo vi /Applications/XAMPP/xamppfiles/etc/my.cnf授予权限

  3. Add skip-grant-tables at the end of [mysqld] section [mysqld]部分的末尾添加skip-grant-tables

  4. Restart mysql server sudo /Applications/XAMPP/xamppfiles/bin/mysql.server restart 重启mysql server sudo /Applications/XAMPP/xamppfiles/bin/mysql.server restart

  5. Connect with mysql server (username and password are not required) mysql 连接mysql服务器(不需要用户名和密码) mysql

  6. Type following commands respectively: 分别输入以下命令:

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

    FLUSH PRIVILEGES;

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

Now you are good to go :) 现在你很高兴去:)

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

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