Docker 安装 mysql
1、docker搜索并下载mysql镜像
docker search mysql ;
docker pull mysql:5.7 (5.7:版本号);
2、创建mysql的镜像,并运行
docker run --name you-mysql -p 3308:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql
进入mysql的终端授权(否则无法远程访问)
[root@iZm5e1ddjnirvbbk9p5zmlZ ~]# docker exec -it you-mysql mysql -uroot -p123456
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'***.***.***.***' IDENTIFIED BY '123456';