1.先查看服务器docker容器的使用情况,查看mysql是否运行
docker ps
可以看到每个容器的id
2.进入mysql容器内部
docker exec -it 这里是mysql的容器id bash
3.然后输入mysql
4.输入命令修改密码
alter user 'root'@'localhost' identified with mysql_native_password by '新密码';
5.
flush privileges;
这样就修改成功了。
如果需要支持远程连接,可以:
6.
然后即可。