MySQL:为什么不能使用ALL PRIVILEGES创建表?

时间:2016-12-05 16:25:18

标签: mysql

我正在尝试做正确的事情(?)而不是一直以root身份运行MySQL。所以我创建了一个用户' jonathan' @' localhost'列出以下特权:

mysql> SHOW GRANTS FOR CURRENT_USER;
+-------------------------------------------------------------------------+
| Grants for jonathan@localhost                                           |
+-------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'jonathan'@'localhost'                            |
| GRANT ALL PRIVILEGES ON `sampledb`.`sampledb` TO 'jonathan'@'localhost' |
+-------------------------------------------------------------------------+
2 rows in set (0.00 sec)

然而,当我这样做时:

mysql> use sampledb;
Database changed

其次是:

mysql> CREATE TABLE Person ( 
    ->     id int NOT NULL AUTO_INCREMENT,
    ->     name VARCHAR(100),
    ->     address VARCHAR(200),
    ->     birthdate DATE,
    ->     PRIMARY KEY (id)
    -> );
ERROR 1142 (42000): CREATE command denied to user 'jonathan'@'localhost' for table 'person'

上面显示CREATE command denied。为什么这不起作用?我不应该拥有所有特权'并不包括CREATE

2 个答案:

答案 0 :(得分:1)

您是否通过运行以下命令在GRANT之后刷新了MySQL的权限?

FLUSH PRIVILEGES;

答案 1 :(得分:0)

您是否在授权声明后刷新了特权?