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=============== ...
随机推荐
- myeclipse 复制项目不包含svn或CVS目录
目前只记录到2个方法:(SVN和CVS都适用) 方法一:导出法 1.右击需要cp的目录,点击export,General/File System 2.next 3.确认你选择的目录,并勾选:Creat ...
- July 18th 2017 Week 29th Tuesday
My heart is stronger now that you are in it. 我的心里有了你,从此变得更强大. You will no longer feel lonely if ther ...
- ArcSde服务启动后又停止
问题:突然发现ArcSde服务无法启动,“ArcSde服务启动后又停止,......” 环境:Win7+ArcSDE10 +Oracle11g 由于本人使用ArcSde时间不长,基本没有遇到过什么问题 ...
- C#图解教程读书笔记(第6章 类进阶)
类成员声明语句由下列部分组成:核心声明.一组可选的修饰符和一组可选的特性(attribute). [特性] [修饰符] 核心声明 修饰符: 如果有修饰符,必须放在核心声明之前. 如果有多个修饰符,要有 ...
- 记两个std接口equal_range,set_difference
1.equal_range equal_range是C++ STL中的一种二分查找的算法,试图在已排序的[first,last)中寻找value,它返回一对迭代器i和j,其中i是在不破坏次序的前提下, ...
- 解决SpringMVC拦截器拦截静态资源的问题。
在使用SpringMVC进行开发的时候,遇到了以下代码不能执行的情况.而且我已经正确导入了JQuery框架. <script type="text/javascript"&g ...
- bzoj3718 [PA2014]Parking
Description 你的老板命令你将停车场里的车移动成他想要的样子.停车场是一个长条矩形,宽度为w.我们以其左下角顶点为原点,坐标轴平行于矩形的边,建立直角坐标系.停车场很长,我们可以认为它一直向 ...
- 自动下单tomcat版本问题
\xalan\xalan,jar找不到是因为spring boot 中使用的是tomcat8.5,从platform依赖进来的运行时环境是tomcat8,导致覆盖原来的依赖,在platform中移除S ...
- Adobe flash player 因过期而遭到阻止解决办法
最近使用谷歌浏览器时总是提示Adobe flash player 因过期而遭到阻止,这让人很头痛,基本上就是打开一个网页就会弹出一个提示,下面是解决办法. 问题的截图界面: 解决方法:在chrome浏 ...
- 网络解析json
public class myActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceSta ...