忘记密码怎么办
- 修改mysql的配置文件my.cnf,重启mysql容器
[mysqld]
#免密码登录
skip-grant-tables
- 免密码登录进console界面,执行修改账号密码sql语句即可
改密码的语句:
update mysql.user set authentication_string='123456' where user='root';
root@shu:/opt/mysql# docker exec -it mysql bash
root@a7360c453c6b:/# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.7.28 MySQL Community Server (GPL)
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
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> update mysql.user set authentication_string='123456' where user='root';
![](https://img.haomeiwen.com/i9626161/14bff56bef6a4fb2.png)
image.png
- 最后记得把 mysql的配置文件my.cnf 改回来
[mysqld]
# 免密码登录 - 重置密码完毕要删除or注释
# skip-grant-tables
网友评论