zoukankan      html  css  js  c++  java
  • docker 安装 mysql 并且外挂文件目录

    1. 拉取docker 镜像

    docker  pull mysql

    2. 创建挂载目录

    mkdir /docker/mysql/conf
    mkdir /docker/mysql/data
    mkdir /docker/mysql/log

    3. 创建my.cnf文件

    cd /docker/mysql/conf
    vi my.cnf

    4. 插入以下内容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]
    pid-file        = /var/run/mysqld/mysqld.pid
    socket          = /var/run/mysqld/mysqld.sock
    datadir         = /var/lib/mysql
    secure-file-priv= NULL
    # Disabling symbolic-links is recommended to prevent assorted security risks
    symbolic-links=0
     
    # Custom config should go here
    !includedir /etc/mysql/conf.d/

    5. 创建并且启动docker

    docker run 
        -p 3306:3306 
        -e MYSQL_ROOT_PASSWORD=test@123 
        -v /docker/mysql/data:/var/lib/mysql 
        -v /docker/mysql/log:/logs 
        -v /docker/mysql/conf/my.cnf:/etc/mysql/my.cnf 
        --name mysql_1 
        --restart=always 
        -d mysql:latest
  • 相关阅读:
    [GoogleAppEngine]编译问题-locale zh_CN
    [Android]Webview中JS接口调用Java-版本问题
    [HTTP基础]3. HTTP链接
    [WebView]简单总结
    [HTTP基础]1.网络开发必备的HTTP协议知识
    [HTTP基础]2.Http和Socket区别
    [HTTP]Android抓包方法(Wireshark)
    [Android]Process&Thread-基本原理
    [Android]Thread两种实现方法
    [Android]消息队列模型——Thread,Handler,Looper,Massage Queue
  • 原文地址:https://www.cnblogs.com/Jesse-Li/p/14466493.html
Copyright © 2011-2022 走看看