获取镜像,直接获取最新版的 mysql 镜像
docker pull mysql
拉起容器
docker run -it --name mysql --network esnet -p 3306:3306 -e MYSQL_ROOT_PASSWORD=mysql mysql
关于密码,可选:
$ docker run -it --name mysql --network esnet -p 3306:3306 mysql
2020-03-09 03:38:01+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.19-1debian9 started.
2020-03-09 03:38:01+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2020-03-09 03:38:01+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.19-1debian9 started.
2020-03-09 03:38:01+00:00 [ERROR] [Entrypoint]: Database is uninitialized and password option is not specified
You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD
网友评论