首先查看Docker中MySQL容器名称
docker ps
执行docker命令
docker exec -it mysql bash
登录MySQL,命令
mysql -u root -proot
use mysql
CREATE USER 'admin'@'host' IDENTIFIED BY 'admin'; //创建用户
update user set host='%' where user='admin' and host='localhost'; //修改用户权限
flush privileges; //刷新mysql权限
grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;