安装
docker pull mysql:5.7
docker images
运行
docker run -itd --name task-for-student -p 3306:3306 -e MYSQL_ROOT_PASSWORD=密码 mysql:5.7
docker ps
设置MySQL登录密码和远程访问
进入docker中的MySQL
docker exec -it task-for-student bash
登录
mysql -uroot -p
设置
use mysql;
update user set authentication_string = password('密码') where user = 'root';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/289567.html