Skip to content

Commit ac89520

Browse files
authored
Merge pull request laradock#924 from bestlong/fix-mysql-user-cant-see-other-db
Fixing create multiple db MYSQL_USER not show other databases.
2 parents 8a13ae1 + b24d622 commit ac89520

1 file changed

Lines changed: 24 additions & 4 deletions

File tree

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,28 @@
11
###
22
### Copy createdb.sql.example to createdb.sql
3-
### then uncomment and set database name to create you need databases
3+
### then uncomment then set database name and username to create you need databases
4+
#
5+
# example: .env MYSQL_USER=appuser and need db name is myshop_db
6+
#
7+
# CREATE DATABASE IF NOT EXISTS `myshop_db` ;
8+
# GRANT ALL ON `myshop_db`.* TO 'appuser'@'%' ;
9+
#
410
###
11+
### this sql script is auto run when mysql container start and $DATA_SAVE_PATH/mysql not exists.
12+
###
13+
### if your $DATA_SAVE_PATH/mysql is exists and you do not want to delete it, you can run by manual execution:
14+
###
15+
### docker-compose exec mysql bash
16+
### mysql -u root -p < /docker-entrypoint-initdb.d/createdb.sql
17+
###
18+
19+
#CREATE DATABASE IF NOT EXISTS `dev_db_1` COLLATE 'utf8_general_ci' ;
20+
#GRANT ALL ON `dev_db_1`.* TO 'default'@'%' ;
21+
22+
#CREATE DATABASE IF NOT EXISTS `dev_db_2` COLLATE 'utf8_general_ci' ;
23+
#GRANT ALL ON `dev_db_2`.* TO 'default'@'%' ;
24+
25+
#CREATE DATABASE IF NOT EXISTS `dev_db_3` COLLATE 'utf8_general_ci' ;
26+
#GRANT ALL ON `dev_db_3`.* TO 'default'@'%' ;
527

6-
#CREATE DATABASE IF NOT EXISTS `dev_db_1` ;
7-
#CREATE DATABASE IF NOT EXISTS `dev_db_2` ;
8-
#CREATE DATABASE IF NOT EXISTS `dev_db_3` ;
28+
FLUSH PRIVILEGES ;

0 commit comments

Comments
 (0)