windows--docker-指定ip启动mysql

windows--docker-指定ip启动mysql

前提条件

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

安装

1.搜索mysql镜像

1### docker search mysql

2.拉取镜像

1### docker pull mysql

3.查看本地镜像

1### docker images

4.初次启动服务

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

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

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

6.强制删除容器

1### docker rm -f mysql

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

1# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. 2# 3# This program is free software; you can redistribute it and/or modify 4# it under the terms of the GNU General Public License as published by 5# the Free Software Foundation; version 2 of the License. 6# 7# This program is distributed in the hope that it will be useful, 8# but WITHOUT ANY WARRANTY; without even the implied warranty of 9# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10# GNU General Public License for more details. 11# 12# You should have received a copy of the GNU General Public License 13# along with this program; if not, write to the Free Software 14# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 15 16# 17# The MySQL Server configuration file. 18# 19# For explanations see 20# http://dev.mysql.com/doc/mysql/en/server-system-variables.html 21 22[mysqld] 23#表名大小写是否敏感 24lower_case_table_names=1 25 26#更改默认的身份认证插件 27default_authentication_plugin=mysql_native_password 28 29#允许导入导出 30secure-file-priv='' 31 32pid-file = /var/run/mysqld/mysqld.pid 33socket = /var/run/mysqld/mysqld.sock 34datadir = /var/lib/mysql 35secure-file-priv= NULL 36 37# Custom config should go here 38!includedir /etc/mysql/conf.d/ 39

8.重新启动一个mysql容器

1### 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

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

​

​

点赞
收藏

评论区

加载中...

相关推荐

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.