linux-tutorial/docs/docker/service/docker-install-mysql.md

33 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# Docker 安装 MySQL
> 实测环境Centos
## 查看可下载镜像
```docker
# docker search mysql
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/mysql MySQL is a widely used, open-source relati... 5757 [OK]
docker.io docker.io/mariadb MariaDB is a community-developed fork of M... 1863 [OK]
docker.io docker.io/mysql/mysql-server Optimized MySQL Server Docker images. Crea... 397 [OK]
...
```
## 选择下载官方镜像
比如,我想下载最新版本,则执行如下命令:
```docker
docker pull mysql
```
## 使用镜像
```docker
docker run -p 3306:3306 --name mysql -v /opt/docker_v/mysql/conf:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=123456 -d mysql
```
## 资源
* https://hub.docker.com/_/mysql/