我们自己在linux上安装mysql的话,超级麻烦,安装完后还要进行各种各样的配置,之前在docker专题写了用docker安装mysql的快速版本以及修改编码的方式,这里总结一下安装流程和命令。
环境
Linux version 3.10.0-693.2.2.el7.x86_64
docker18.09.2
mysql5.7
安装流程命令
下面我直接快速的说明安装流程和命令,包括中文编码问题的解决。
1、拉取镜像docker pull mysql:5.7
2、创建配置和数据挂载点mkdir-p/data/mysql/data3309
mkdir-p/data/mysql/mysql.conf.d3309
这里启动的容器端口为3309,所以直接命名为3309
3、编写配置文件
新建名称为mysqld.cnf的配置文件,访入/data/mysql/mysql.conf.d3309/目录下,内容如下,目的是覆盖掉容器内的配置文件,好修改编码格式为utf_8,而不是参照网上的进入容器中修改。
# Copyright (c) 2014, 2016, 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 2 of the License.
#
# Thi