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

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)


谢谢

最佳答案

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

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

关于mysql - 无法在mysql中为用户分配权限,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/50564194/

10-10 21:45