mysql的docker化安装
mysql版本有很多,先看下各类版本号说明:
3.X至5.1.X:这是早期MySQL的版本。常见早期的版本有:4.1.7、5.0.56等。
5.4.X到5.7.X:这是为了整合MySQL AB公司社区和第三方公司开发的新存储引擎。吸收新的实现算法,更好的支持SMP架构。为提升性能做了大量代码重构。
6.0.X到7.1.X:这是为了更好推广MySQL Cluster版本,以及提高MySQL性能和稳定性以及新功能。改动MySQL基础功能,从而对Cluster存储引擎提供更有效支持优化。因为发布时间较晚,发布时已经有其他手段解决MySQL集群技术问题,所以并没有很好的推广使用。
看了版本说明就很好选择想要使用的版本了,由于笔者常用的是5.7.13版本,此处就以此为例,步骤就是先查寻并获取镜像(此处略)。
镜像获取完成后启动mysql,到容器里面看下配置文件my.conf:
[root@devlop ~]# sudo docker exec -it mysql bash
root@b60ba70e2447:/# cat /etc/mysql/
conf.d/ my.cnf
root@b60ba70e2447:/# cat /etc/mysql/my.cnf
# Copyright (c) , , Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., Franklin St, Fifth Floor, Boston, MA - USA #
# The MySQL Community Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html [client]
port =
socket = /var/run/mysqld/mysqld.sock [mysqld_safe]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
nice = [mysqld]
skip-host-cache
skip-name-resolve
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port =
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
explicit_defaults_for_timestamp # Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1 #log-error = /var/log/mysql/error.log # Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links= # * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
root@b60ba70e2447:/#
看到配置后,就可以把自己想要的目录持久化出来了,且注意时区转换:
docker run --name mysqltest -p : -v /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime -v /data/mysql:/var/lib/mysql -eMYSQL_ROOT_PASSWORD=root-password -d mysql:5.7.
启动完成后进入容器连一下mysql,并看看时区:
[root@devlop ~]# docker exec -it mysqltest bash
root@5446ce5c7ddf:/# mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.7. MySQL Community Server (GPL) Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> select now();
+---------------------+
| now() |
+---------------------+
| -- :: |
+---------------------+
row in set (0.01 sec)
安装完成。
mysql的docker化安装的更多相关文章
- mongodb副本集的docker化安装
1. 定义 一般只要生产环境就需要考虑冗余设计,保证在某一台服务器由于某种原因宕机后服务还可以正常运行. mongo副本集是一组服务器,其中有一个主服务器(primary),用于处理客户端请求:还有多 ...
- mongodb的docker化安装
查询mongo镜像 docker search mongo 拉取镜像(拉取STARS最多的那个就可以了) docker pull mongo tips:如果拉取不成功,多pull几次就可以了. 使用自 ...
- redis的docker化安装
只需要关注几点: 端口映射 配置文件映射 持久化映射 要做的就是拉取官方镜像并把关注的几个点处理一下就好了: docker pull redis docker run -d -p : -v /data ...
- docker化安装grafana
继续进行docker改造. 1. 找镜像.拉取镜像 [root@devlop ~]# docker search grafana INDEX NAME DESCRIPTION STARS OFFICI ...
- [MySQL] MySQL的自己主动化安装部署
有过MySQL运维的人应该都清楚,线上的MySQL一般都採用源代码编译,由于这样才干够依据企业的各自须要选择要编译的功能,尽管MySQL的源代码编译挺简单的,可是试想一下,假设你有几百台server同 ...
- 在docker中安装mysql
#!/bin/sh # 安装docker # 在docker中安装mysql # 解决了docker容器中无法输入中文的问题 ##########################安装docker # ...
- CentOS双机中Docker下安装Mysql并配置互为主从模式
CentOS双机中Docker下安装Mysql并配置互为主从模式 目录 1.搜索镜像... 1 2.拉取镜像... 1 3.绑定端口: 1 4.配置文件(修改/etc/mysql/my.cnf文件): ...
- docker微服务部署之:四、安装docker、docker中安装mysql和jdk1.8、手动构建镜像、部署项目
docker微服务部署之:三,搭建Zuul微服务项目 1.Centos7安装Docker 详见:Centos7安装Docker 2.Docker中安装jdk1.8 详见:使用Docker构建jdk1. ...
- 【docker】【mysql】docker安装mysql,阿里云docker镜像加速器,docker搜索查看远程仓库上的镜像,docker拉取镜像,查看本地所有镜像,查看容器的运行状况,查看容器的详细信息
在docker上安装mysql有两种方式 1.通过Dockerfile构建 2.直接在docker hub上拉取镜像安装 =================本篇采用方法2=============== ...
随机推荐
- c/c++ 按照行读取文件
本文代码都在Windows/VC++6.0下测试过, 在linux/g++下也没有问题. 但是请一定注意linux和Windows文件格式的区别,比如: 1. 当linux上的代码读取Windows文 ...
- 【转】Spark on Yarn遇到的几个问题
本文转自 http://www.cnblogs.com/Scott007/p/3889959.html 1 概述 Spark的on Yarn模式,其资源分配是交给Yarn的ResourceManage ...
- MSSQL 备份与恢复
建立维护计划,需启用<SQL Server 代理>服务 建立三个子作业: 1. 按周进行的全备份,每周日零点执行 2. 按天进行的差异备份,每天中午12点执行 3. 按小时执行的事务日志备 ...
- Oracle案例04——TNS-12547: TNS:lost contact
Oracle数据库服务器DG从库重启后,无法完成数据同步,具体报错信息如下: 一.报错信息 alter log报错 ****************************************** ...
- nest 排序
var result = client.Search<Person>(x => x.Index("personindex").Type("persont ...
- css z-index层重叠顺序
一.z-index语法与结构 z-index 跟具体数字 如:div{z-index:100}注意:z-index的数值不跟单位. z-index的数字越高越靠前,并且值必须为整数和正数(正数的整数) ...
- 【深入理解JAVA虚拟机】第一部分.走进Java
Java技术体系 如果仅从传统意义上来看,Sun官方所定义的Java技术体系包括以下几个组成部分:Java程序设计语言各种硬件平台上的Java虚拟机Class文件格式Java API类库来自商业机构和 ...
- python UI自动化实战记录六:页面1用例编写
使用python自带的unittest测试框架,用例继承自unittest.TestCase类. 1 引入接口类和页面类 2 setUp函数中打开页面,定义接口对象 3 tearDown函数中关闭页面 ...
- spring集成ehcache本地缓存
1.maven依赖 <!-- ehcache 相关依赖 --> <dependency> <groupId>net.sf.ehcache</groupId&g ...
- 【CSS单位】px、em、rem
1.PX为单位 在Web页面初期制作中,我们都是使用“px”来设置我们的文本,因为他比较稳定和精确.但是这种方法存在一个问题,当用户在浏览器中浏览我们制作的Web页面时,他改变了浏览器的字体大小,这时 ...