
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
!https://www.mysql.com/common/logos/logo-mysql-170x115.png
MySQL is the world's most popular open source database. With its proven performance, reliability, and ease-of-use, MySQL has become the leading choice of database for web applications of all sorts, ranging from personal websites and small online shops all the way to large-scale, high profile web operations like ***, ***, and ***.
For more information and related downloads for MySQL Server and other MySQL products, please visit http://www.mysql.com.
Warning
The MySQL Docker images maintained by the MySQL team are built specifically for Linux platforms. Other platforms are not supported, and users using these MySQL Docker images on them are doing so at their own risk. See https://dev.mysql.com/doc/refman/8.0/en/deploy-mysql-nonlinux-docker.html for some known limitations for running these containers on non-Linux operating systems.
These are tags for some of the optimized MySQL Server Docker images, created and maintained by the MySQL team at Oracle (for a full list, see https://hub.docker.com/r/mysql/mysql-server/tags/).
MySQL Server 5.7 (tag: https://github.com/mysql/mysql-docker/blob/mysql-server/5.7/Dockerfile) (https://github.com/mysql/mysql-docker/blob/mysql-server/5.7/Dockerfile)
MySQL Server 8.0, the latest GA, for both x86 and AArch64(ARM64) architectures (tag: https://github.com/mysql/mysql-docker/blob/mysql-server/8.0/Dockerfile) (https://github.com/mysql/mysql-docker/blob/mysql-server/8.0/Dockerfile)
Images are updated when new MySQL Server maintenance releases and development milestones are published. Please note that any non-GA releases are for preview purposes only and should not be used in production setups.
We also from time to time publish special MySQL Server images that contain experimental features.
Detailed documentation: See https://dev.mysql.com/doc/refman/8.0/en/linux-installation-docker.html in the https://dev.mysql.com/doc/refman/8.0/en/.
Where to file issues: Please submit a bug report at http://bugs.mysql.com under the category “MySQL Package Repos and Docker Images”.
Maintained by: The MySQL team at Oracle
Source of this image: The https://github.com/mysql/mysql-docker
Supported Docker versions: The latest stable release is supported. Support for older versions (down to 1.0) is provided on a best-effort basis, but we strongly recommend using the most recent stable Docker version, which this documentation assumes.
Downloading the server image in a separate step is not strictly necessary; however, performing this before you create your Docker container ensures your local image is up to date.
To download the MySQL Community Edition image, run this command:
shell> docker pull mysql/mysql-server:tag
Refer to the list of supported tags above. If :tag is omitted, the latest tag is used, and the image for the latest GA version of MySQL Server is downloaded.
Start a new Docker container for the MySQL Community Server with this command:
shell> docker run --name=mysql1 -d mysql/mysql-server:tag
The --name option, for supplying a custom name for your server container (mysql1 in the example), is optional; if no container name is supplied, a random one is generated. If the Docker image of the specified name and tag has not been downloaded by an earlier docker pull or docker run command, the image is now downloaded. After download completes, initialization for the container begins, and the container appears in the list of running containers when you run the docker ps command; for example:
shell> docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES a24888f0d6f4 mysql/mysql-server "/entrypoint.sh my..." 14 seconds ago Up 13 seconds (health: starting) 3306/tcp, 33060/tcp mysql1
The container initialization might take some time. When the server is ready for use, the STATUS of the container in the output of the docker ps command changes from (health: starting) to (healthy).
The -d option used in the docker run command above makes the container run in the background. Use this command to monitor the output from the container:
shell> docker logs mysql1
Once initialization is finished, the command's output is going to contain the random password generated for the root user; check the password with, for example, this command:
shell> docker logs mysql1 2>&1 | grep GENERATED GENERATED ROOT PASSWORD: Axegh3kAJyDLaRuBemecis&EShOs
Once the server is ready, you can run the mysql client within the MySQL Server container you just started and connect it to the MySQL Server. Use the docker exec -it command to start a mysql client inside the Docker container you have started, like this:
shell> docker exec -it mysql1 mysql -uroot -p
When asked, enter the generated root password (see the instructions above on how to find it). Because the MYSQL_ONETIME_PASSWORD option is true by default, after you have connected a mysql client to the server, you must reset the server root password by issuing this statement:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
Substitute password with the password of your choice. Once the password is reset, the server is ready for use.
A number of MySQL products are included in the Docker container you created with the MySQL Server Docker image:
MySQL Server and other MySQL Programs including the https://dev.mysql.com/doc/refman/8.0/en/mysql.html client,https://dev.mysql.com/doc/refman/8.0/en/mysqladmin.html, https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html, and so on. See the https://dev.mysql.com/doc/refman/8.0/en/programs-overview.html for documentation of the products.
MySQL Shell. See the https://dev.mysql.com/doc/refman/8.0/en/mysql-shell.html for documentation of the product.
For more topics on deploying MySQL Server with Docker like starting and connecting to the server, server configuration, persisting data and configuration, server error log, server upgrades, and the Docker environment variables, see https://dev.mysql.com/doc/refman/8.0/en/linux-installation-docker.html in the MySQL Server manual.
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务
以下是 mysql/mysql-server 相关的常用 Docker 镜像,适用于 不同场景 等不同场景: