MySQL 8.0 Docker使用注解

PUBLIC | AUTOMATED BUILD

cytopia/mysql-8.0

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))

原文地址:https://www.cnblogs.com/it-tsz/p/8973635.html

时间: 2024-11-08 22:57:10

MySQL 8.0 Docker使用注解的相关文章

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

Preface     Several days ago,I've implement a docker environmnet,I'm gonna Install a MySQL 8.0 version on it.Let's see the detail of it.   Procedure Check and run docker container again. 1 [[email protected] vagrant]# docker images 2 REPOSITORY TAG I

docker+mysql(8.0.15)+node.js(hapi.js)构建容器(命令行)

安装docker, 准备一个node.js项目,项目中包含数据库配置. 一.将node.js项目创建为image 在项目中创建.dockerignore文件和dockerfile文件(https://github.com/hanxiaoer1992/docker_nodejs_cmd) cd 项目文件夹下(cd ....../docker_nodejs_cmd) docker image build -t dockertest:0.0.1 . 二.拉取mysql docker pull mysq

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

从Docker登录MySQL的终端 docker exec -it wordpress-mysql /bin/bash 登录数据库 mysql -u root -p 使用MYSQL数据库 use mysql 查询MYSQL的root用户情况 select host, user, plugin from user; 修改root用户插件验证方式 ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'xxxxxxxxxx';

Spring MVC 3.0.5+Spring 3.0.5+MyBatis3.0.4全注解实例详解(一)

Spring更新到3.0之后,其MVC框架加入了一个非常不错的东西——那就是REST.它的开放式特性,与Spring的无缝集成,以及Spring框架的优秀表现,使得现在很多公司将其作为新的系统开发框架.大象根据实际的项目经验,以之前SSH2例子为基础,对其进行一次大改造,详细的为大家讲解如何实现SSM3全注解式的开发. 这次大象将采取两种构建方式,一是很多人喜欢用的MyEclipse,另一个,则是用Eclipse+Maven.这一篇,将主要讲解开发环境设置与Maven构建方式. 1. 开发环境

Linux安装mysql.8.0.12

1. linux安装mysql8.0.12,亲测可用. 以下是安装过程中出现的问题: 1 [[email protected] file]# systemctl start mysqld 2 Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe"

Atitit.mysql&#160;5.0&#160;5.5&#160;&#160;5.6&#160;5.7&#160;&#160;新特性&#160;新功能

Atitit.mysql 5.0 5.5  5.6 5.7  新特性 新功能 1. MySQL  5.6    5 大新特性1 1.1. 优化器的改进1 1.2. InnoDB 改进1 1.3. 使用 memcached API 直接访问 NoSQL2 1.4. 更好的复制2 1.5. Performance Schema2 2. MySQL 5.7.62 2.1. 内建中文全文索引2 2.2. 多主复制2 2.3. other2 3. 参考2 1. MySQL  5.6    5 大新特性 M

MySQL &#183; 8.0版本更新 &#183; 性能优化篇

摘要: 本文主要总结下MySQL在8.0版本和性能相关的一些改动,随着新的小版本的发布,本文将不断进行更新,直到正式GA. 已更新版本MySQL 8.0.0MySQL 8.0.0 WL#9387: InnoDB: Group purging of rows by table ID 这个问题最早是faceb... 本文主要总结下MySQL在8.0版本和性能相关的一些改动,随着新的小版本的发布,本文将不断进行更新,直到正式GA. MySQL 8.0.0 WL#9387: InnoDB: Group

Atitit.mysql 5.0 5.5 &#160;5.6 5.7 &#160;新特性 新功能

Atitit.mysql 5.0 5.5  5.6 5.7  新特性 新功能 1. MySQL  5.6    5 大新特性1 1.1. 优化器的改进1 1.2. InnoDB 改进1 1.3. 使用 memcached API 直接访问 NoSQL2 1.4. 更好的复制2 1.5. Performance Schema2 2. MySQL 5.7.62 2.1. 内建中文全文索引2 2.2. 多主复制2 2.3. other2 3. 参考2 1. MySQL  5.6    5 大新特性 M

RedHat下apache\ftp\mysql 4.0 的安装方法

RedHat下安装这三个服务的方法大同小异 Apache服务: 找到Apache安装包: rpm -ivh httpd-2.0.40-21.i386.rpm 等待安装完成即可 检查安装结果: rpm -qa|grep httpd 有回显httpd-2.0.40-21即表示安装成功. 启动apache服务: service httpd start 通过浏览器访问 IP地址80端口 即可打开apache测试网站 注意事项: 1.apache 服务无法启动,主机名与IP不匹配 解决方法: 手动修改主机