我已经以root身份登录,并输入以下命令
GRANT ALL PRIVILEGES ON *.* TO 'hive'@'master' WITH GRANT OPTION;
结果是
Query OK, 0 rows affected, 1 warning (0.00 sec)
警告信息为:
Warning | 1285 | MySQL is started in --skip-name-resolve mode; you must restart it without this switch for this grant to work
然后我检查了用户'hive'的授权
mysql> show grants for hive;
+-----------------------------------------------------------------------------------------------------+
| Grants for hive@% |
+-----------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'hive'@'%' IDENTIFIED BY PASSWORD '*4DF1D66463C18D44E3B001A8FB1BBFBEA13E27FC' |
+-----------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
我尝试了一下
show grants for 'hive'@'master'
ERROR 1141 (42000): There is no such grant defined for user 'hive' on host 'master'
为什么grant命令在这里不起作用?
我在/etc/my.cnf
中禁用了skip-name-resolv,它就可以工作了。
http://mysql-forum.ch/archive/index.php?thread-5.html
我认为警告主要是由于使用主机名“master”而不是IP地址引起的。
但是,在/etc/my.cnf
中禁用skip-name-resolv是否合适?还是有其他选择?