镜像的安装 docker pull mysql/mysql-server 启动容器 docker run -d -p:3307:3306 --name mysqltest mysql/mysql-server(这里设置了3307指向3306,也就是意味着远程连接端口为3307)
执行下面命令查看容器日志,找到MySql的root账户的密码
docker logs mysqltest
docker exec -it mysqltest bash(退出容器)
mysql -uroot -p(进入mysql)
alter user 'root'@'localhost' identified by 'wdk123456';(修改密码)
修改完root密码后,可以使用下面代码切换到mysql数据库 use mysql
查看下用户信息
select user,host from user
感觉像是配置远程连接(如果不行可以试试下面提供的网页)
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'wdk123456';
https://blog.csdn.net/qq_40013999/article/details/90513894