bitscn.com
mysql增加普通用户后无法登陆问题的解决方法
今天安装openstack folsom版本,安装完mysql,为各个服务增加对应的数据库和用户后,发现
无法使用新增的用户登陆mysql。我增加用户的方法如下:
mysql -uroot -p$mysql_pass
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!
bitscn.com