MariaDB远程root用户无法授权

一 问题描述

[email protected]‘%’用户授予的all权限,但是用该用户远程登录数据库给其他用户授权时报错:

MariaDB [(none)]> GRANT REPLICATION SLAVE ON *.*  TO 'ReplUser'@'192.168.144.10';
ERROR 1045 (28000): Access denied for user 'root'@'%' (using password: YES)

二 出错原因

远程root用户的grant_priv是关闭状态:

MariaDB远程root用户无法授权

三 解决办法

将远程root用户的grant_priv改为Y:

MariaDB [(none)]> update mysql.user set grant_priv='Y' where user='root' and host='%';
Query OK, 1 row affected (0.002 sec)
Rows matched: 1  Changed: 1  Warnings: 0

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.003 sec)
重新用该远程root用户登录,进行授权,不再报错了。