Grant ALL on Database 它没有向我的特定 IP 授予任何特权

Grant ALL on Database it's not granting any privileges to my specific IP

我正在尝试将所有权限授予特定 IP,但是当我尝试获取特权 IP 列表时,它总是只显示本地主机,我按照此 question 中的说明操作,但它没有做任何改变,我做错了什么?

MariaDB [(none)]> GRANT ALL ON database.* TO 'root'@'192.168.3.1' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> show grants;
+---------------------------------------------------------------------+
| Grants for root@localhost                                           |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION        |
+---------------------------------------------------------------------+
2 rows in set (0.00 sec)

mysql> show slave status;
ERROR 1227 (42000): Access denied; you need (at least one of) the SUPER,REPLICATION CLIENT privilege(s) for this operation
mysql> show grants;
+------------------------------------------------------------------+
| Grants for root@192.168.1.5                                      |
+------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'root'@'192.168.1.5'                       |
| GRANT ALL PRIVILEGES ON `western_star`.* TO 'root'@'192.168.1.5' |
+------------------------------------------------------------------+
2 rows in set (0.00 sec)

注:

即使我使用我的用户远程登录并且我有权限,我仍然被拒绝。

mysql> show slave status;
ERROR 1227 (42000): Access denied; you need (at least one of) the SUPER,REPLICATION CLIENT privilege(s) for this operation
mysql> show grants;
+------------------------------------------------------------------+
| Grants for root@192.168.1.5                                      |
+------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'root'@'192.168.1.5'                       |
| GRANT ALL PRIVILEGES ON `western_star`.* TO 'root'@'192.168.1.5' |
+------------------------------------------------------------------+
2 rows in set (0.00 sec)

试试运行这个语句:

SHOW GRANTS FOR 'root'@'192.168.3.1' ;

与 return 相比:

SHOW GRANTS FOR 'root'@'localhost' ; 

SHOW GRANTS 显示 当前用户 .

的授权

请注意 "root@localhost" 与 "root@192.168.3.1" 不是 同一用户。 MySQL 通过用户和主机标识用户。 (那是两个 不同的 用户。)


跟进

SUPER 和 REPLICATION CLIENT 权限是全局权限,不是数据库权限。授予这些权限的语法是 ON *.*。例如:

GRANT REPLICATION CLIENT ON *.* TO 'root'@'192.168.1.5' ;