# Docker MySQL 8.x Image (AMD64/ARM64)
The official MySQL repo image only supports AMD64 processors, and as Apple has introduced M1 chips (ARM64), I decided to build my own image so that dockerized apps that use MySQL can work without configuration changes on both the AMD64 and ARM64 processors.
This image inherits nearly all settings from the official docker [MySQL](https://hub.docker.com/_/mysql) image,
but the `mysql_native_password authentication` plugin is enabled by default.
The root user is also granted permission to log in from any host e.g `@%` by default , so you can connect with [tableplus](https://tableplus.com) or similar database managers. You can change the host by setting the env var `MYSQL_ROOT_HOST`.
The default username is `root` and password is `root`, however you can change by setting the new password in the env var `MYSQL_ROOT_PASSWORD`.
If you want it to create a database then set `MYSQL_DATABASE` with the database name. The image will also create a new user for you if you supply both a `MYSQL_USER` and `MYSQL_PASSWORD`. If you are creating both a user and database, then full permissions will be granted to the new user from any host.
### Docker Compose Service
To add as a service to your `docker-compose.yml`
```yaml
services:
db:
image: jamielsharief/mysql:latest
volumes:
- mysql-data:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=root
ports:
- "3307:3306"
```
### Container
To work with a normal container, remember you need to setup volumes so data is persisted.
To start a MySQL container with the username `root` and password `root`
```
$ docker run -it -d -p 3306:3306 jamielsharief/mysql:latest
```
To change the root password
```
$ docker run -it -p 3306:3306 -e MYSQL_ROOT_PASSWORD=foo jamielsharief/mysql:latest
```
To create a database
```
$ docker run -it -p 3306:3306 -e MYSQL_DATABASE=application jamielsharief/mysql:latest
```
To create a user you must supply both a username and password
```
$ docker run -it -p 3306:3306 -e MYSQL_USER=jon -e MYSQL_PASSWORD=secret jamielsharief/mysql:latest
```
If you are creating a user and a database, full permissions will be granted for that
user on that database.
Here is a full example
```
$ docker run -it -p 3306:3306 -e MYSQL_ROOT_PASSWORD=foo -e MYSQL_USER=roger -e MYSQL_PASSWORD=beck -e MYSQL_DATABASE=application jamielsharief/mysql:latest
```
## Resources
- [Github](https://github.com/jamielsharief/docker-mysql)
- [Docker Hub](https://hub.docker.com/r/jamielsharief/mysql)
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
Docker MySQL 8.x 镜像 (AMD64/ARM64) 官方 MySQL 存储库映像仅支持 AMD64 处理器,并且由于 Apple 推出了 M1 芯片 (ARM64),我决定构建自己的映像,以便使用 MySQL 的 dockerized 应用程序可以在 AMD64 和 ARM64 处理器上运行而无需更改配置。 该镜像几乎继承了官方mysql_native_password authentication 镜像的所有设置,但默认启用了mysql_native_password authentication插件。 root 用户还被授予从任何主机登录的权限,例如默认情况下@% ,因此您可以连接或类似的数据库管理器。 您可以通过设置环境MYSQL_ROOT_HOST来更改主机。 默认用户名是root ,密码是root ,但是您可以通过在环境MYSQL_ROOT_PASSWOR
资源详情
资源评论
资源推荐
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 8 条
- 1
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![tar](https://img-home.csdnimg.cn/images/20210720083646.png)
![rpm](https://img-home.csdnimg.cn/images/20210720083646.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![txt](https://img-home.csdnimg.cn/images/20210720083642.png)
![none](https://img-home.csdnimg.cn/images/20210720083646.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![thumb](https://img-home.csdnimg.cn/images/20210720083646.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![exe](https://img-home.csdnimg.cn/images/20210720083343.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![avatar](https://profile-avatar.csdnimg.cn/7f3004a7bce94547848f3cb44f0b1f74_weixin_42153801.jpg!1)
吾自行
- 粉丝: 58
- 资源: 4670
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)
评论0