windows--docker-指定ip启动mysql

windows--docker-指定ip启动mysql

前提条件

默认电脑已经安装好了docker,以及自定义配置docker的网络; 若无请参考 [链接](https://www.helloworld.net/p/8667165341)

安装

1.搜索mysql镜像

### docker search mysql

2.拉取镜像

### docker pull mysql

3.查看本地镜像

### docker images

4.初次启动服务

### docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:latest --default-authentication-plugin=mysql_native_password

5.拷贝配置文件(注意目标地址)

### docker cp mysql:/etc/mysql/my.cnf D:/docker/mysql/conf/

6.强制删除容器

### docker rm -f mysql

7.修改宿主机的my.cnf文件

# Copyright (c) 2017, 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. # # 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # The MySQL Server configuration file. # # For explanations see # http://dev.mysql.com/doc/mysql/en/server-system-variables.html [mysqld] #表名大小写是否敏感 lower_case_table_names=1 #更改默认的身份认证插件 default_authentication_plugin=mysql_native_password #允许导入导出 secure-file-priv='' pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock datadir = /var/lib/mysql secure-file-priv= NULL # Custom config should go here !includedir /etc/mysql/conf.d/

8.重新启动一个mysql容器

### docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -v D:/docker/mysql/data:/var/lib/mysql/ -v D:/docker/mysql/conf/my.cnf:/etc/mysql/my.cnf -v D:/docker/mysql/mysql-files:/var/lib/mysql-files/ --network zdd_docker_network --ip 172.18.0.9 -d mysql:latest

9.使用navicat客户端工具连接

10.相关配置sql

mysql设置大小写是否敏感的一个参数。 lower_case_table_names=0 表名存储为给定的大小和比较是区分大小写的 lower_case_table_names = 1 表名存储在磁盘是小写的,但是比较的时候是不区分大小写 lower_case_table_names=2 表名存储为给定的大小写但是比较的时候是小写的 show VARIABLES like 'lower_case_table_names' 查看mysql当前使用的字符集 SHOW VARIABLES LIKE 'character_set_%'; 查看版本信息 select version() from dual;

点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

windows--docker-rocketMQ-指定ip启动rocketMQ及监控web

dockerwindows指定ip启动rocketMQ及监控web前提条件tex默认电脑已经安装好了docker,以及自定义配置docker的网络;若无请参考https://www.helloworld.net/p/8

VBox 启动虚拟机失败

在Vbox(5.0.8版本)启动Ubuntu的虚拟机时,遇到错误信息:NtCreateFile(\\Device\\VBoxDrvStub)failed:0xc000000034STATUS\_OBJECT\_NAME\_NOT\_FOUND(0retries) (rc101)Makesurethekern

FLV文件格式

1.        FLV文件对齐方式FLV文件以大端对齐方式存放多字节整型。如存放数字无符号16位的数字300(0x012C),那么在FLV文件中存放的顺序是:|0x01|0x2C|。如果是无符号32位数字300(0x0000012C),那么在FLV文件中的存放顺序是:|0x00|0x00|0x00|0x01|0x2C。2.