mysql增加新用户无法登陆解决方法_MySQL
程序员文章站
2022-04-28 11:17:20
...
bitsCN.com
今天安装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
无法使用新增的用户登陆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
上一篇: MariaDB半同步复制的实现方法
推荐阅读
-
phpmyadmin无法连接到mysql服务器1045解决方法
-
mac-在Mac下安装了mysql,密码无法登陆
-
php后台经常提示无法连接mysql 刷新后又可以访问的解决方法_MySQL
-
Mysql 5.5 无法远程登陆:Can't get hostname for your address_MySQL
-
mysql 1418无法创建函数的解决方法_MySQL
-
mysql 1418无法创建函数的解决方法_MySQL
-
php+mysql第一条数据无法显示的原因和解决方法
-
安装MySQL 5后无法启动(不能Start service)解决方法小结
-
mysql增加新用户无法登陆解决方法
-
MySQL无法启动、无法停止解决方法(安全设置后容易出现)