File tree Expand file tree Collapse file tree
mysql/docker-entrypoint-initdb.d Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 ;
You can’t perform that action at this time.
0 commit comments