Merge pull request #937 from bestlong/fix-percona-create-multiple-db-user-cant-see

Fixing Percona service create multiple db solution
This commit is contained in:
Mahmoud Zalt 2017-05-13 16:47:43 +03:00 committed by GitHub
commit 109e596417
2 changed files with 25 additions and 4 deletions

View File

@ -215,6 +215,7 @@ services:
- MYSQL_ROOT_PASSWORD=${PERCONA_ROOT_PASSWORD} - MYSQL_ROOT_PASSWORD=${PERCONA_ROOT_PASSWORD}
volumes: volumes:
- percona:/var/lib/mysql - percona:/var/lib/mysql
- ./percona/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
ports: ports:
- "${PERCONA_PORT}:3306" - "${PERCONA_PORT}:3306"
networks: networks:

View File

@ -1,8 +1,28 @@
### ###
### Copy createdb.sql.example to createdb.sql ### Copy createdb.sql.example to createdb.sql
### then uncomment and set database name to create you need databases ### then uncomment then set database name and username to create you need databases
#
# example: .env MYSQL_USER=appuser and need db name is myshop_db
#
# CREATE DATABASE IF NOT EXISTS `myshop_db` ;
# GRANT ALL ON `myshop_db`.* TO 'appuser'@'%' ;
#
###
### this sql script is auto run when percona container start and $DATA_SAVE_PATH/percona not exists.
###
### if your $DATA_SAVE_PATH/percona is exists and you do not want to delete it, you can run by manual execution:
###
### docker-compose exec percona bash
### mysql -u root -p < /docker-entrypoint-initdb.d/createdb.sql
### ###
#CREATE DATABASE IF NOT EXISTS `dev_db_1` ; #CREATE DATABASE IF NOT EXISTS `dev_db_1` COLLATE 'utf8_general_ci' ;
#CREATE DATABASE IF NOT EXISTS `dev_db_2` ; #GRANT ALL ON `dev_db_1`.* TO 'homestead'@'%' ;
#CREATE DATABASE IF NOT EXISTS `dev_db_3` ;
#CREATE DATABASE IF NOT EXISTS `dev_db_2` COLLATE 'utf8_general_ci' ;
#GRANT ALL ON `dev_db_2`.* TO 'homestead'@'%' ;
#CREATE DATABASE IF NOT EXISTS `dev_db_3` COLLATE 'utf8_general_ci' ;
#GRANT ALL ON `dev_db_3`.* TO 'homestead'@'%' ;
FLUSH PRIVILEGES ;