今天安裝openstack folsom版本,安裝完mysql,為各個服務增加對應的數據庫和用戶後,發現
無法使用新增的用戶登陸mysql。我增加用戶的方法如下:
mysql -uroot -p$MYSQL_PASS <<EOF
CREATE DATABASE nova;
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY '$MYSQL_PASS';
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY '$MYSQL_PASS';
CREATE DATABASE keystone;
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%'IDENTIFIED BY '$MYSQL_PASS';
CREATE DATABASE cinder;
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%'IDENTIFIED BY '$MYSQL_PASS';
CREATE DATABASE quantum;
GRANT ALL PRIVILEGES ON quantum.* TO 'quantum'@'%'IDENTIFIED BY '$MYSQL_PASS';
FLUSH PRIVILEGES;
EOF
但使用用戶登陸失敗:
root@controller:~# mysql -h localhost -ukeystone -ppassword
ERROR 1045 (28000): Access denied for user 'keystone'@'localhost' (using password: YES)
解決方法:
增加普通用戶後,執行:
mysql> use mysql
mysql> delete from user where user='';
mysql> flush privileges;
意思是刪除匿名用戶。
OK,搞定,enjoy!