刚修改密码后就忘记,囧囧囧囧囧。记录一下,以便以后犯了同样的错误可以快速找到解决方法。

测试阶段,还是使用的 TiUP cluster 在单机上模拟生产环境部署步骤单机模拟生产环境
先停止tidb

tiup cluster stop <cluster-name>

然后找到 tidb-server 的配置文件,一般默认是在

cd /tidb-deploy/tidb-4000/conf

vi tidb.toml

添加如下security

[security]
skip-grant-table = true

然后找到 tidb-server 的启动文件,具体在 deploy 目录下的script/run_tidb.sh,一般是

/tidb-deploy/tidb-4000/scripts

由于 tidb 限制了 skip 模式只能在操作系统 root 用户启动 tidb-server 才可以进行,所以要用 root 用户来执行上面的脚本

sudo sh run_tidb.sh

此时再次登录 tidb,就会发现不需要输入 root 密码了.

mysql -h 127.0.0.1 -P 4000 -u root

登录之后

SET PASSWORD FOR 'root'@'%' = 'xxx';
#或者
ALTER USER 'test'@'localhost' IDENTIFIED BY 'mypass';

重置成功之后记得恢复配置文件及启动脚本即可。

tiup cluster start <cluster-name>

来源:oschina

链接:https://my.oschina.net/hnqingping1255/blog/4492171

相关文章:

  • 2021-08-14
  • 2022-12-23
  • 2022-12-23
  • 2021-10-10
  • 2022-02-09
  • 2021-06-14
  • 2021-12-09
猜你喜欢
  • 2022-12-23
  • 2021-11-28
  • 2021-09-26
  • 2021-09-24
  • 2021-11-30
相关资源
相似解决方案