在tidbserver中使用 mysql -uroot -p -h127.0.0.1 -P4000连接tidb提示1045的错误

【 TiDB 使用环境`】测试环境
【 TiDB 版本】5.4
【遇到的问题】
【复现路径】在我部署的测试集群上使用 mysql -uroot -p -h127.0.0.1 -P4000 提示1045错误
【问题现象及影响】
无法使用tidb连接数据库,单独的使用mysql -uroot -p -h127.0.0.1 输入密码的后正常进入mysql5.7
如代码显示:
[root@vdeGvJ1018471 data]# mysql -h127.0.0.1 -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.37-log Source distribution

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql> ERROR 1045 (28000): Access denied for user ‘root’@‘127.0.0.1’ (using password: YES^C
mysql> exit
Bye
[root@vdeGvJ1018471 data]# mysql -uroot -p -h127.0.0.1 -P 4000
Enter password:
ERROR 1045 (28000): Access denied for user ‘root’@‘127.0.0.1’ (using password: YES)
[root@vdeGvJ1018471 data]# mysql -uroot -p -P4000 -h127.0.0.1
Enter password:
ERROR 1045 (28000): Access denied for user ‘root’@‘127.0.0.1’ (using password: YES)
[root@vdeGvJ1018471 data]#

【附件】

请提供各个组件的 version 信息,如 cdc/tikv,可通过执行 cdc version/tikv-server --version 获取。

确认一下tidb的端口 -P4000

mysql -uroo -p -h127.0.0.1 -P 4000

用户名不对吧

root你打成roo了

你这个明显是细节问题,提问题之前,先确认这个问题是不是自己的失误吧。
你这登陆tidb的用户是roo,不确定是不是故意的哈,至少先换成root再试一次吧。

1 个赞

使用root用户也不行的

root帐号也不行,看了下其他问题,貌似这个帐号是不能有密码的,我新创建一个帐号,不使用密码试试

你启动TiDB的时候,是不是加了 --init 的选项?这个会给root用户生成一个默认的密码。


大神,端口是开启的

-h 指定真实IP试下

https://docs.pingcap.com/zh/tidb/stable/production-deployment-using-tiup#第-7-步启动集群
如果是按这个步骤启动的集群,需要留意这里产生的随机密码

3 个赞

感谢您的回复!我是使用这个方式安装的,

非常感谢,已经可以登录了

密码错误哈?

:+1::+1:

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