Skip to content

Commit

Permalink
perf($MySQL): simplify MySQL configuration for docker-compose
Browse files Browse the repository at this point in the history
Init user in the MySQL script
  • Loading branch information
johnnymillergh committed Jun 27, 2021
1 parent 305e12b commit 7f4a017
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docker/config/mysql-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ These files below are MySQL initialization scripts:
```
script
mysql
init_replication_user.sql
init_user.sql
muscle_and_fitness.sql
```

Expand Down
4 changes: 0 additions & 4 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ services:
MYSQL_ROOT_HOST: "%"
MYSQL_ROOT_PASSWORD: ${MAF_MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MAF_MYSQL_DATABASE}
MYSQL_USER: ${MAF_MYSQL_USER_RW}
MYSQL_PASSWORD: ${MAF_MYSQL_PASSWORD}
TZ: ${MAF_TIMEZONE}
ports:
- "3306:3306"
Expand All @@ -39,8 +37,6 @@ services:
MYSQL_ROOT_HOST: "%"
MYSQL_ROOT_PASSWORD: ${MAF_MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MAF_MYSQL_DATABASE}
MYSQL_USER: ${MAF_MYSQL_USER_R}
MYSQL_PASSWORD: ${MAF_MYSQL_PASSWORD}
ports:
- "3307:3306"
restart: always
Expand Down
2 changes: 0 additions & 2 deletions docker/script/mysql/init_replication_user.sql

This file was deleted.

8 changes: 8 additions & 0 deletions docker/script/mysql/init_user.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CREATE USER 'replication_user'@'%' IDENTIFIED BY 'replication_password';
GRANT REPLICATION SLAVE ON *.* TO 'replication_user'@'%';

CREATE USER 'maf_mysql_rw'@'%' IDENTIFIED BY 'maf@mysql';
GRANT SELECT, INSERT, UPDATE, DELETE ON *.* TO 'maf_mysql_rw'@'%';

CREATE USER 'maf_mysql_r'@'%' IDENTIFIED BY 'maf@mysql';
GRANT SELECT ON *.* TO 'maf_mysql_r'@'%';

0 comments on commit 7f4a017

Please sign in to comment.