我正在使用5.5.35-MariaDBServer进行openstack安装。
下面两个命令用于插入用户keystone的权限:
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY 'keystone';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY 'keystone';
flush privileges;但是我在指定主机名时遇到了访问拒绝问题,主机名写在/etc/host文件中。当使用'localhost‘的访问运行良好时。
[root@controller mariadb]# mysql -ukeystone -pkeystone -hcontroller
ERROR 1045 (28000): Access denied for user 'keystone'@'controller' (using password: YES)
[root@controller mariadb]# mysql -ukeystone -pkeystone -hlocalhost
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 98
Server version: 5.5.35-MariaDB MariaDB Server我的解决办法是显式地授予主机名的特权,然后它就工作了:
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'controller' IDENTIFIED BY 'keystone';这是正常行为吗,因为上面的通配符主机‘%’不起作用??
更新
查询结果是:
MariaDB [(none)]> SELECT User, Host FROM mysql.user WHERE User = 'keystone';
+----------+-----------+
| User | Host |
+----------+-----------+
| keystone | % |
| keystone | localhost |
+----------+-----------+
2 rows in set (0.00 sec)ip地址和主机名类似于:
[root@controller rc]# ip address show Mgmt | grep inet
inet 10.0.10.101/24 brd 127.255.255.255 scope global Mgmt
inet6 fe80::a00:27ff:fe9e:6e1a/64 scope link
[root@controller rc]# cat /etc/hosts | grep controller
10.0.10.101 controller发布于 2016-07-22 07:00:06
用户主机名显式而不是“localhost”。它修正了1045错误。
授予“keystone”的所有特权。*“keystone”@“控制器”,由“keystone”标识;
https://stackoverflow.com/questions/33052505
复制相似问题