zoukankan      html  css  js  c++  java
  • docker安装mysql8.0

    1,下载docker镜像

    docker pull mysql:8.0

    2,建立主机目录

    mkdir -p /opt/mysql/conf /opt/mysql/data /opt/mysql/logs

    3,创建mysql8.0配置文件

    vim /opt/mysql/conf/my.cnf

     1 [mysqld]
     2 #datadir=/usr/local/mysql/data
     3 default_authentication_plugin=mysql_native_password  #使用mysql8以前的密码插件,以便navicat等工具能够正常连接
     4 default-storage-engine=INNODB
     5 character_set_server = utf8
     6 secure_file_priv=/var/lib/mysql
     7 [mysqld_safe]
     8 character_set_server = utf8
     9 [mysql]
    10 default-character-set = utf8
    11 [mysql.server]
    12 default-character-set = utf8
    13 [client]
    14 default-character-set = utf8

    4,创建容器脚本

    vim /opt/mysql/docker.sh

    1 docker run -p 3306:3306 --name mysql \
    2 -v /opt/mysql/logs:/var/log/mysql \
    3 -v /opt/mysql/data:/var/lib/mysql \
    4 -v /opt/mysql/conf:/etc/mysql \
    5 -e MYSQL_ROOT_PASSWORD=root \
    6 -d mysql:8.0

    ./docker.sh

    5,配置mysql对外开放连接权限(如果外界navicat联不通,一般docker版的mysql是可以从外界直接连通的)

    docker exec -it mysql mysql -uroot -proot

    use mysql

    select host,user from user;

    update user set host = '%' where user = 'root';

    flush privileges;

    select host,user from user;

  • 相关阅读:
    adb入门学习笔记
    adb连接手机模拟器
    burp抓取手机模拟器流量
    Windows 下安装drozer(Windows 10),连接手机(红米note4X)
    UnicodeEncodeError: 'ascii' codec can't encode characters in position
    Windows下的Nessus安装与启动
    对VAuditDemo的一次审计
    http协议
    namp详解
    sqlmap详解
  • 原文地址:https://www.cnblogs.com/guanghe/p/15625174.html
Copyright © 2011-2022 走看看