Home > Database > Mysql Tutorial > body text

mysql增加普通用户后无法登陆问题的解决方法_MySQL

WBOY
Release: 2016-06-01 13:38:16
Original
838 people have browsed it

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
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template