Commit eb66ea43 authored by daidekun's avatar daidekun

修改db

parent 28e49c46
# VERSION 1.0
FROM mysql:5.6.37 FROM mysql:5.6.37
MAINTAINER kalvin <dekun.dai@quantgroup.cn>
#定义工作目录 #定义工作目录
ENV WORK_PATH /home/quant_group/mysql ENV WORK_PATH /home/quant_group/mysql
...@@ -14,7 +11,8 @@ WORKDIR $WORK_PATH ...@@ -14,7 +11,8 @@ WORKDIR $WORK_PATH
RUN mkdir -p sql_to_run RUN mkdir -p sql_to_run
COPY mysqld.cnf /etc/mysql/mysql.conf.d/mysqld.cnf COPY my.cnf /etc/mysql/mysql.conf.d/mysqld.cnf
COPY mysqld_charset.cnf /etc/mysql/conf.d/mysqld_charset.cnf
COPY ./sql_to_run/0-init_user_and_db.sql ./sql_to_run/ COPY ./sql_to_run/0-init_user_and_db.sql ./sql_to_run/
#把要执行的shell文件放到/docker-entrypoint-initdb.d/目录下,容器会自动执行这个shell #把要执行的shell文件放到/docker-entrypoint-initdb.d/目录下,容器会自动执行这个shell
COPY ./init_db_data.sh $AUTO_RUN_DIR/ COPY ./init_db_data.sh $AUTO_RUN_DIR/
......
# Copyright (c) 2014, 2016, 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
log-error = /var/log/mysql/error.log
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
max_connections = 1000
\ No newline at end of file
[mysqld]
character_set_server=utf8
character_set_filesystem=utf8
collation-server=utf8_general_ci
init-connect='SET NAMES utf8'
init_connect='SET collation_connection = utf8_general_ci'
skip-character-set-client-handshake
\ No newline at end of file
# VERSION 1.0
FROM mysql:5.6.37
MAINTAINER kalvin <dekun.dai@quantgroup.cn>
#定义工作目录
ENV WORK_PATH /home/quant_group/mysql
#定义会被容器自动执行的目录
ENV AUTO_RUN_DIR /docker-entrypoint-initdb.d
WORKDIR $WORK_PATH
RUN mkdir -p sql_to_run
COPY mysqld.cnf /etc/mysql/mysql.conf.d/mysqld.cnf
COPY ./sql_to_run/0-init_user_and_db.sql ./sql_to_run/
#把要执行的shell文件放到/docker-entrypoint-initdb.d/目录下,容器会自动执行这个shell
COPY ./init_db_data.sh $AUTO_RUN_DIR/
#给执行文件增加可执行权限
RUN chmod a+x $AUTO_RUN_DIR/init_db_data.sh
\ No newline at end of file
# -------------------------------------------------------------------------------
# Filename: init_db_data.sh
# Revision: 1.0
# Date: 2017/08
# Author: dekun.dai
# Description: 执行目录下所有数据库脚本
# -------------------------------------------------------------------------------
sql_file_folder=$WORK_PATH/sql_to_run
echo "cd $sql_file_folder"
cd $sql_file_folder
for entry in ./*
do
echo "run sql file: $entry"
mysql -uroot -pQuantgroup2017 < $entry
done
\ No newline at end of file
CREATE DATABASE xyqb;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE xyqb_app;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE payment_center;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE risk_control;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE dujiangyan;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE mall;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE qinqiong;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE cash_loan_flow;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE quartz;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE contract;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE fund_manage;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE financial_system;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE gyxd;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE offline;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE redpacket;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE spider_center;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE xyqb_user;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE merchant;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE user_credit;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
CREATE DATABASE silk_road;
GRANT ALL PRIVILEGES ON *.* TO 'qa'@'%' IDENTIFIED BY 'qatest';
flush privileges;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment