
This is a docker image of mysql that comes configured for use with DataJoint!
WARNING Whether hosted via Docker or directly on a machine, the MySQL server needs to be administered properly. Please refer to an appropriate reference to administer the server safely and efficiently.
docker-composeThe simplest and the recommended way to configure and run a MySQL server with Docker is to use the Docker compose. Once you have docker and docker-compose installed on your system (the one on which you'd want to run the MySQL server), copy this https://raw.githubusercontent.com/datajoint/mysql-docker/master/docker-compose.yaml to a folder, and run docker-compose up -d to start the MySQL server. Here is a series of commands to run in the terminal to achieve this:
bash$ mkdir mysql-docker $ cd mysql-docker $ wget https://raw.githubusercontent.com/datajoint/mysql-docker/master/docker-compose.yaml $ sudo docker-compose up -d
This will start the MySQL server mapped to localhost's port 3306, and any MySQL data will be stored in the directory ./data, or if you followed the above instructions, mysql-docker/data directory.
By default the database sets up user root with password simple (refer to below on how to change this at the startup). You can access your locally running MySQL server using mysql client. On Ubuntu system, you can obtain this by installing apt package mysql-client as follows:
bash$ sudo apt-get install mysql-client
Once mysql client is installed, you can access the running server:
bash$ mysql -h 127.0.0.1 -u root -p Enter password: [type in your password here: default is "simple"] mysql >
Read on to find out the details about the content of the docker-compose.yaml and how you can customize it to fit your needs.
docker-compose.yaml?The content of the docker-compose.yaml is rather simple:
yamlversion: '2' services: db: image: datajoint/mysql ports: - "3306:3306" environment: - MYSQL_ROOT_PASSWORD=simple volumes: - ./data:/var/lib/mysql
Let's step through the parts you might want to customize. The line
yaml- MYSQL_ROOT_PASSWORD=simple
configures the default password. If you would like to use something else, you can modify this prior to starting your server with docker-compose up.
The lines:
yamlvolumes: - ./data:/var/lib/mysql
maps the local directory ./data to the /var/lib/mysql inside the container where MySQL stores all of its data by default.
WARNING: If you decide map volume /var/lib/mysql (like in the example), then settings for your MySQL server will persist across separate Docker mysql instances. In particular, this means that the MYSQL_ROOT_PASSWORD setting will be used only when the very first mysql Docker container is created. To change the root password on an alredy created mysql Docker instance, access the database via mysql client as root and run:
bash$ mysql -h 127.0.0.1 -u root -p Enter password: [type in your old password] mysql > SET PASSWORD FOR root = PASSWORD('your_new_password');
replacing the 'your_new_password' with your new desired password surrounded by quotes (').
以下是 datajoint/mysql 相关的常用 Docker 镜像,适用于 关系型数据库、事务处理、数据存储 等不同场景:
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。

探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
docker search 限制
站内搜不到镜像
离线 save/load
插件要用 plugin install
WSL 拉取慢
安全与 digest
新手拉取配置
镜像合规机制
不支持 push
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
域名连通性排查
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务