MySQL 8.0 Docker使用注解
MySQL 8.0 Docker
<small>Latest build: 2017-08-30</small>
mysql 5.5 | mysql 5.6 | mysql 5.7 | mysql 8.0 | mariadb 5.5 | mariadb 10.0 | mariadb 10.1 | mariadb 10.2 | mariadb 10.3 | percona 5.5 | percona 5.6 | percona 5.7
MySQL 8.0 Docker on CentOS 7

<sub>This docker image is part of the devilbox</sub>
Options
Environmental variables
Required environmental variables
| Variable | Type | Description |
|---|---|---|
| MYSQL_ROOT_PASSWORD | string | MySQL root user password of either existing database or in case it does not exist it will initialize the new database with the given password. |
Optional environmental variables
| Variable | Type | Default | Description |
|---|---|---|---|
| DEBUG_COMPOSE_ENTRYPOINT | bool | 0 |
Show shell commands executed during start.<br/>Value: 0 or 1 |
| TIMEZONE | string | UTC |
Set docker OS timezone.<br/>Example: Europe/Berlin |
| MYSQL_SOCKET_DIR | string | /var/sock/mysqld |
Path inside the docker to the socket directory.<br/><br/>Used to separate socket directory from data directory in order to mount it to the docker host or other docker containers.<br/><br/>Mount this directory to a PHP container and be able to use mysqli_connect with localhost. |
| MYSQL_GENERAL_LOG | bool | 0 |
Turn on or off general logging<br/>Corresponds to mysql config: general-log<br/>Value: 0 or 1 |
Default mount points
| Docker | Description |
|---|---|
| /var/lib/mysql | MySQL data dir |
| /var/log/mysql | MySQL log dir |
| /var/sock/mysqld | MySQL socket dir |
| /etc/mysql/conf.d | MySQL configuration directory (used to overwrite MySQL config) |
| /etc/mysql/docker-default.d | MySQL configuration directory (used to overwrite MySQL config) |
Default ports
| Docker | Description |
|---|---|
| 3306 | MySQL listening Port |
Usage
1. Listen on loopback interface only
$ docker run -i \
-p 127.0.0.1:3306:3306 \
-e MYSQL_ROOT_PASSWORD=my-secret-pw \
-t cytopia/mysql-8.0
# Access MySQL from your host computer
$ mysql --user=root --password=my-secret-pw --host=127.0.0.1 -e 'show databases;'
2. Enable logging
Enable logging and mount the log directory to your host to ~tmp/mysql-log
$ docker run -i \
-p 127.0.0.1:3306:3306 \
-v ~tmp/mysql-log:/var/log/mysql \
-e MYSQL_ROOT_PASSWORD=my-secret-pw \
-e MYSQL_GENERAL_LOG=1 \
-t cytopia/mysql-8.0
# Access MySQL from your host computer
$ mysql --user=root --password=my-secret-pw --host=127.0.0.1 -e 'show databases;'
3. Mount MySQL socket to the host
Use MySQL socket for localhost connections through the socket. No need to expose the MySQL port to the host in this case.
$ docker run -i \
-v ~tmp/mysql-sock:/var/sock/mysqld \
-e MYSQL_ROOT_PASSWORD=my-secret-pw \
-t cytopia/mysql-8.0
# Access MySQL from your host computer via socket
$ mysql --user=root --password=my-secret-pw --socket=/var/sock/mysqld/mysqld.sock -e 'show databases;'
4. Overwrite configuration
You can also add any configuration settings prior startup to MySQL.
# Create local config with buffer overwrite
$ printf "[mysqld]\n%s\n" "key_buffer = 500M" > ~/tmp/mysqld_config/buffer.cnf
$ docker run -i \
-p 127.0.0.1:3306:3306 \
-v ~/tmp/mysqld_config:/etc/mysql/conf.d \
-e MYSQL_ROOT_PASSWORD=my-secret-pw \
-t cytopia/mysql-8.0
MySQL Configuration overview
Configuration files inside this docker are read in the following order:
| Order | File | Description |
|---|---|---|
| 1 | /etc/my.cnf |
Operating system default |
| 2 | /etc/mysql/conf.d/ |
Custom configuration (level 1). Can be mounted to provide custom *.cnf files which can overwrite anything of the above. (used by the devilbox for its base configuration) |
| 3 | /etc/mysql/docker-default.d/*.cnf |
Custom configuration (level 2). Can be mounted to provide custom *.cnf files which can overwrite anything of the above. (used by the devilbox to allow custom user-defined configuration overwriting the default devilbox settings. |
Modules
[Version]
/usr/sbin/mysqld Ver 8.0.2-dmr for Linux on x86_64 (MySQL Community Server (GPL))
MySQL 8.0 Docker使用注解的更多相关文章
- docker 安装 MySQL 8.0
1.查找镜像 查找Docker Hub上的mysql镜像 X230:~$ docker search mysql NAME DESCRIPTION STARS OFFICIAL AUTOMATED m ...
- docker mysql 8.0
Pull library/mysql $ docker pull mysql Load image $ docker load -i mysql.tar Save image $ docker sav ...
- docker安装MySQL 8.0及初始化错误处理
Preface Several days ago,I've implement a docker environmnet,I'm gonna Install a MySQL 8. ...
- 通过 Docker 部署 Mysql 8.0 主从模式
文章转载自:http://www.mydlq.club/article/106/ 系统环境: Mysql 版本:8.0.23 Docker 版本:19.03.13 一.为什么需要 Mysql 主从复制 ...
- centos docker 安装mysql 8.0
centos 版本 CentOS Linux release 7.5.1804 (Core) 内核版本: 3.10.0-862.el7.x86_64 下载最新版mysql docker pull m ...
- Docker For MYSQL 8.0 特别注意修复数据库新的验证方式
从Docker登录MySQL的终端 docker exec -it wordpress-mysql /bin/bash 登录数据库 mysql -u root -p 使用MYSQL数据库 use my ...
- <亲测>用navicat连接mysql 8.0 报错2059
ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded 2018年05月07日 15:56 ...
- kubernetes集群部署mysql 8.0
参考:https://blog.csdn.net/sealir/article/details/81177747?utm_source=blogxgwz1 集群内安装mysql并添加相应存储(PVC) ...
- Linux安装mysql.8.0.12
1. linux安装mysql8.0.12,亲测可用. 以下是安装过程中出现的问题: 1 [root@localtest1 file]# systemctl start mysqld 2 Job fo ...
随机推荐
- PhoneUtil
package cn.fraudmetrix.octopus.horai.biz.utils; import org.springframework.util.StringUtils; import ...
- BZOJ:1816 [Cqoi2010]扑克牌 (贪心或二分答案)
题面 \(solution:\) 这道题难就难在你能否读懂题目的意思,我们将它翻译一下: 现在我有n根竹子(每根竹子有\(c_i\)节,每节竹子高度为1),我可以通过消耗一点法力值使某一根竹子的某两节 ...
- Flask最强攻略 - 跟DragonFire学Flask - 第六篇 Flask 中内置的 Session
Flask中的Session非常的奇怪,他会将你的SessionID存放在客户端的Cookie中,使用起来也非常的奇怪 1. Flask 中 session 是需要 secret_key 的 from ...
- 虚方法virtual、抽象方法abstract、接口interface区别
接口.抽象类.抽象方法.虚方法: 这四个名词时非常容易混淆的: 首先说一下接口 与抽象类 的异同: 相同点: 1.他们都不能实例化自己,也就是说都是用来被继承的. 2.抽象类中的抽象方法和接口方法一样 ...
- 一个DOS攻击木马的详细分析过程
一个DOS攻击木马的详细分析过程 0×01 起因 网路流量里发现了大量的的1.exe的文件,而且一直在持续,第一感觉就像是一个木马程序,而且每个1.exe的MD5都不一样,对比发现只有几个字节不一样( ...
- JavaScript从初见到热恋之深度讨论JavaScript中的面向对象。
JavaScript中的面向对象.面向对象的三个基本特征:封装.继承.多态. 1.封装 js的封装如下 定义Person类 function Person(name,age,sex) { this.n ...
- Difference between plt.draw() and plt.show() in matplotlib
Difference between plt.draw() and plt.show() in matplotlib down voteaccepted plt.show() will display ...
- python日志和异常
“日志”转载:http://www.cnblogs.com/dkblog/archive/2011/08/26/2155018.html "异常"转载:http://www.cnb ...
- python系统编码转换
# coding:gbk import sys import locale def p(f): print '%s.%s(): %s' % (f.__module__, f.__name__, f() ...
- Oracle11g_OCM 课堂教学目录表
注:本文为原著(其内容来自 腾科教育培训课堂).阅读本文注意事项如下: 1:所有文章的转载请标注本文出处. 2:本文非本人不得用于商业用途.违者将承当相应法律责任. 3:该系列文章目录列表: 一:&l ...