mysql授予GRANT_OPTION和CREATE_USER

时间:2016-02-16 15:44:57

标签: mysql

我试图创建一个只有一些特权的用户。

首先登录mysql

* mysql -u root -p Server version: 5.6.28-0ubuntu0.15.10.1

创建用户

* CREATE USER 'createuser'@'%' IDENTIFIED BY 'createuser'; Query OK, 0 rows affected (0,00 sec)

现在我想授予特权

* GRANT CREATE, GRANT_OPTION, CREATE_USER, RELOAD ON *.* TO 'createuser'@'%'; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GRANT_OPTION, CREATE_USER, RELOAD ON *.* TO 'createuser'@'%'' at line 1

所以我把突击队分成4个

* GRANT CREATE ON *.* TO 'createuser'@'%'; Query OK, 0 rows affected (0,00 sec)

* GRANT GRANT_OPTION ON *.* TO 'createuser'@'%'; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GRANT_OPTION ON *.* TO 'createuser'@'%'' at line 1

* GRANT CREATE_USER ON *.* TO 'createuser'@'%'; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE_USER ON *.* TO 'createuser'@'%'' at line 1

* GRANT RELOAD ON *.* TO 'createuser'@'%'; Query OK, 0 rows affected (0,00 sec)

那么授予CREATE_USERGRANT_OPTION

的突击队是什么?

2 个答案:

答案 0 :(得分:1)

删除下划线,它会起作用。

答案 1 :(得分:-1)

使用grant选项将database_name.table_name上的create user授予root_user;

同花顺权限