无法在mysql中为用户分配权限

时间:2018-05-28 10:22:51

标签: mysql mariadb privileges

我正在尝试创建一个新用户并为其分配权限,但它不起作用。以下是错误。

MariaDB [(none)]> CREATE USER 'admin'@'localhost' IDENTIFIED BY '****';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH 
GRANT OPTION;
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using 
password: YES)

由于

1 个答案:

答案 0 :(得分:0)

最后,它通过下面的命令工作。

GRANT ALL PRIVILEGES ON `%`.* TO '[user]'@'[hostname]' IDENTIFIED BY '[password]' WITH GRANT OPTION;