我和一个团队成员很困惑,因为向远程用户授予权限的命令失败了,但没有错误。新用户已使用 CREATE USER 成功添加到 mysql.user,但 GRANT PRIVILEGES 后跟 FLUSH PRIVILEGES 不会影响授权表。这两个命令都应该说“查询确定”。0 行受影响,'他们这样做。但是 SHOW GRANTS 并没有显示新的权限,我们也不能从指定的远程 ip 使用该用户名登录。谁能解释以下行为?
mysql> SELECT CURRENT_USER(); ///I'm definitely in as root user
+----------------+
| CURRENT_USER() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'myNewUser'@'remoteIP'; //grant to existing user
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> SHOW GRANTS;
| Grants for root@localhost
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*////TakenOut///' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION
2 rows in set (0.00 sec)
我希望第三行具有“myNewUser”的权限。