表现为按照官方文档 https://dev.mysql.com/doc/refman/8.0/en/resetting-permissions.html 中的说明 B.3.3.2.3 Resetting the Root Password: Generic Instructions

执行 ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass'; 还是不能成功更改

进入mysql docker 发现使用 mysql -u root -p 就能登录,但是使用 mysql -h 127.0.0.1 -P 3306 -u root -p 不能登录,怀疑是本地登录和网络登录配置不同。

你可以先看看mysql的user表

mysql> select host,user,authentication_string from mysql.user;

host: 允许用户登录的ip,%表示可以远程,localhost表示本机;

user:当前数据库的用户名;

我这里是需要远程登录的密码改掉,所以执行 ALTER USER 'root'@'%' IDENTIFIED BY 'MyNewPass'; 即可

相关文章:

  • 2021-09-09
  • 2022-12-23
  • 2021-05-30
  • 2022-12-23
  • 2021-06-19
  • 2022-02-07
  • 2021-10-14
  • 2021-11-07
猜你喜欢
  • 2021-04-17
  • 2021-10-07
  • 2022-12-23
  • 2021-11-30
  • 2021-06-26
相关资源
相似解决方案