tidb授权新用户登陆问题

tidb版本:TiDB Version: v4.0.9
目前tidb集群有6台机器:192.168.10.10~192.168.10.15
授权命令为:grant all privileges on . to ‘tidb’@’%’ identified by ‘123456’;
见鬼的事情来了,当我192.168.10.10~192.168.10.15的任何一台机器,通过mysql -utidb -P4000 -h 192.168.10.10 -p123456 登陆时ok,
但是当我在192.168.10.17登陆时,ERROR 1045 (28000): Access denied for user ;
日志:[2021/01/14 09:34:56.597 +08:00] [WARN] [conn.go:636] [“open new session failure”] [conn=8] [error="[server:1045]Access denied for user ‘tidb’@‘192.168.10.17’ (using password: YES)"]
请大侠指导;

创建了两个用户 a1 和 a2
分别使用以下两个语句
create user ‘a2’@‘%’ identified by ‘a2’;
grant all privileges on . to ‘a2’@‘%’;

create user ‘a1’@‘%’;
grant all privileges on . to ‘a1’@‘%’ identified by ‘a1’;

创建完两个用户后可以查看 mysql.user 的 authentication_string 列。
发现 a1 的 authentication_string 是空的。

使用 a2 用户登录
[root@r10 opt]# mysql -ua2 -P4100 -hr11 -pa2
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 21
Server version: 5.7.25-TiDB-v4.0.4 TiDB Server (Apache License 2.0) Community Edition, MySQL 5.7 compatible

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

使用 a1 用户登录
[root@r10 opt]# mysql -ua1 -P4100 -hr11 -pa1
ERROR 1045 (28000): Access denied for user ‘a1’@‘192.168.12.10’ (using password: YES)

1 个赞

结论,
要在创建用户的会后就建好密码。
或者使用 alter user 命令更改密码。

1 个赞

此话题已在最后回复的 1 分钟后被自动关闭。不再允许新回复。