MySQL CREATE 命令拒绝用户?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9887364/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 12:43:52  来源:igfitidea点击:

CREATE command denied to user?

mysqlmysql-error-1142

提问by 37336792

show grants for charm@'localhost';

---------------------+
| Grants for charm@localhost                                                                                   |
+-----------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'charm'@'localhost' IDENTIFIED BY PASSWORD '*EDD1CD76B1331E363B2BAED3F0B7EAF28559FBEWD' |
| GRANT ALL PRIVILEGES ON `charmstyle_com`.`charmstyle_com` TO 'charm'@'localhost' 

i used

我用了

grant all on charmstyle_com to charm@'localhost' IDENTIFIED BY 't1q4gytrur';
flush privileges;

then i import the database,it shows an error:

然后我导入数据库,它显示一个错误:

   ERROR 1142 (42000) at line 29: CREATE command denied to user 'charm'@'localhost' for table 'adminnotification_inbox'

回答by scibuff

You granted the user permissions only to the 'charmstyle_com' table inside the 'charmstyle_com' database. What you probably want is to grant permissions to all the tables in 'charmstyle_com' (or at least the 'adminnotification_inbox' table)

您仅授予用户对 'charmstyle_com' 数据库内的 'charmstyle_com' 表的权限。您可能想要的是向“charmstyle_com”中的所有表(或至少是“adminnotification_inbox”表)授予权限

 GRANT ALL PRIVILEGES ON `charmstyle_com`.* TO 'charm'@'localhost' 

alternatively

或者

 GRANT ALL PRIVILEGES ON `charmstyle_com`.`adminnotification_inbox` 
     TO 'charm'@'localhost'