docker部署mysql 5.7版本

mysql

目录结构

── mysql
    ├── conf
    │   └── my.cnf
    └── init
        └── init.sql
创建配置文件
vim ./mysql/conf/my.cnf
[mysqld]
pid-file    = /var/run/mysqld/mysqld.pid
socket      = /var/run/mysqld/mysqld.sock
datadir     = /var/lib/mysql
#log-error  = /var/log/mysql/error.log
# By default we only accept connections from localhost
bind-address   = 0.0.0.0
# Disabling symbolic-links is recommended to prevent assorted security risks
#symbolic-links=0

初始化 init.sql ,在容器创建完成后将执行

vim ./mysql/conf/init.sql

use mysql;
CREATE USER 'test'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'test'@'%';
FLUSH PRIVILEGES;
  • 添加远程账号
  • 创建基础数据库

docker-compose.yml

version: '3'

services:
  mysql:
    container_name: mysql
    environment:
      MYSQL_ROOT_PASSWORD: 123456
    image: mysql:5.7
    ports:
      - '3306:3306'
    volumes:
      - './mysql/conf/my.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf'
      - './mysql/logs:/logs'
      - './mysql/data:/var/lib/mysql'
      - './mysql/init:/docker-entrypoint-initdb.d/'
    restart: always

 上一篇
pm2日志管理pm2-logrotat pm2日志管理pm2-logrotat
参考网址:https://github.com/keymetrics/pm2-logrotate 简介就是开个线程对pm2的日志进行监控和操作。 以下测试版本为: pm2:3.0.3 pm2-logrotate:2.6.0 请确保版本对
2018-08-17
下一篇 
stellar资料 stellar资料
stellar测试链浏览器:http://testnet.stellarchain.io/ stellar正式链浏览器:https://stellarchain.io/ stellar-core(节点)源码地址:https://github
2018-08-14
  目录