重装系统下载了Mysql 5.7.20版本 配置启动完成发现一直无法修改密码。
首先使用 update user set password=password('123456') where user='root'; 命令修改,报错如下图:
然后改用 update mysql.user set authentication_string=password('123') where user='root' and Host ='localhost'; 命令提示修改成功。
但是退出后重新使用新密码登录报错:
然后上网搜了多篇博客试过各种方法,发现解决办法:
首先进入Mysql,执行 use mysql;命令, 然后使用 update mysql.user set authentication_string=password('123') where user='root' and Host = 'localhost'; 修改登录密码,
完成后执行 flush privileges; 命令来保存。完成修改密码:
至此就可以使用新密码登录
用点小麻烦开始第一篇博客。