PUBLIC | AUTOMATED BUILD

Last pushed: 8 months ago

Short Description
MySQL 8.0 on CentOS 7
Full Description

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使用注解的更多相关文章

  1. docker 安装 MySQL 8.0

    1.查找镜像 查找Docker Hub上的mysql镜像 X230:~$ docker search mysql NAME DESCRIPTION STARS OFFICIAL AUTOMATED m ...

  2. docker mysql 8.0

    Pull library/mysql $ docker pull mysql Load image $ docker load -i mysql.tar Save image $ docker sav ...

  3. docker安装MySQL 8.0及初始化错误处理

      Preface          Several days ago,I've implement a docker environmnet,I'm gonna Install a MySQL 8. ...

  4. 通过 Docker 部署 Mysql 8.0 主从模式

    文章转载自:http://www.mydlq.club/article/106/ 系统环境: Mysql 版本:8.0.23 Docker 版本:19.03.13 一.为什么需要 Mysql 主从复制 ...

  5. centos docker 安装mysql 8.0

    centos 版本  CentOS Linux release 7.5.1804 (Core) 内核版本: 3.10.0-862.el7.x86_64 下载最新版mysql docker pull m ...

  6. Docker For MYSQL 8.0 特别注意修复数据库新的验证方式

    从Docker登录MySQL的终端 docker exec -it wordpress-mysql /bin/bash 登录数据库 mysql -u root -p 使用MYSQL数据库 use my ...

  7. <亲测>用navicat连接mysql 8.0 报错2059

    ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded 2018年05月07日 15:56 ...

  8. kubernetes集群部署mysql 8.0

    参考:https://blog.csdn.net/sealir/article/details/81177747?utm_source=blogxgwz1 集群内安装mysql并添加相应存储(PVC) ...

  9. Linux安装mysql.8.0.12

    1. linux安装mysql8.0.12,亲测可用. 以下是安装过程中出现的问题: 1 [root@localtest1 file]# systemctl start mysqld 2 Job fo ...

随机推荐

  1. python 线程 event

    全局定义了一个“Flag”,如果“Flag”值为 False,那么当程序执行 event.wait 方法时就会阻塞,如果“Flag”值为True,那么执行event.wait 方法时便不再阻塞. cl ...

  2. SpringMVC的JSON数据交互(七)-@Response,@RestController,@RequestBody用法

    1.@RequestBody   (自动将请求的数据封装为对象) 作用: @RequestBody注解用于读取http请求的内容(字符串),通过springmvc提供的HttpMessageConve ...

  3. RPC原理

    RPC同步调用流程:(异步另说) 1)服务消费方(Client)以本地的调用方式调用远程服务. 2)客户端代理(Client Stub)接收到调用后负责将方法.参数等组装成能够进行网络传输的消息体. ...

  4. MySQL版本升级参考资料【转】

    MySQL升级参考资料 MySQL 升级的最佳实践 - 技术翻译 - 开源中国社区https://www.oschina.net/translate/mysql-upgrade-best-practi ...

  5. Linux系统打开core dump的配置【转】

    什么是core dump core dump又叫核心转储, 当程序运行过程中发生异常, 程序异常退出时, 由操作系统把程序当前的内存状况存储在一个core文件中, 叫core dump.core du ...

  6. C/C++杂记:深入虚表结构

    1. 虚表与“虚函数表” 在“C/C++杂记:虚函数的实现的基本原理”一文中曾提到“虚函数表”的概念,只是为了便于理解,事实是:虚函数表并不真的独立存在,它只是虚表(virtual table)中的一 ...

  7. html的结构-厂子型的布局

    上图所示的布局设计是很常见的.这个该怎么做呢? 技术需求:header 要固定住在顶部,不随鼠标滚动而向上移动:左边的div的有一定的宽度,但是要贴浏览器的底部(屏幕顶部):右边的dv要占据右边的全屏 ...

  8. bootgrid 刷新保持当前排序

    1. 前言 主要是利用了HTHNL5的localStorage技术和用ajax传输一个数组到后台并进行判断.这篇文章是解决一个小需求而来的,主要是用来记录. 2. 代码 JavaScript: var ...

  9. Python-CSS入门

    一.架构分析 页面 => div的层级结构 => 具有采用哪些功能标签显示内容 结构层 > 位置层(布局层) > 内容层 二.css引入 - 行间式 <!-- 简单直接, ...

  10. PHP中嵌套函数被调用时出现报错的问题

    对于初入门的PHP新手来说,在学习关于PHP函数嵌套的知识点时可能会有一定的难度.比如有的朋友在练习PHP函数嵌套相关问题时,会遇到调用内部函数时就会出现报错的情况等. 那么本篇文章就为大家详细得分析 ...