从数据库查询一些信息
mysql> select user,host from user;
查询的结果如下
+------------------+-----------+
| user | host |
+------------------+-----------+
| root | % |
| admin | localhost |
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| zhangj | localhost |
+------------------+-----------+
开始修改密码
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123';
参考资料:
MYSQL8.0以上版本正确修改ROOT密码