Created
May 10, 2022 14:56
-
-
Save JosePedroDias/17a1e1c6e281010942144c9de71b61f3 to your computer and use it in GitHub Desktop.
mysql 5.7 docker-composed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql -h localhost -u USER -P 3306 -p --protocol=TCP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM mysql/mysql-server:5.7.38 | |
# place | |
ADD init-users.sql /docker-entrypoint-initdb.d/ | |
ADD init-db.sql /docker-entrypoint-initdb.d/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE USER IF NOT EXISTS 'USER'@'%' IDENTIFIED BY 'password'; | |
ALTER USER 'USER'@'%' IDENTIFIED WITH mysql_native_password BY 'password'; | |
GRANT ALL PRIVILEGES ON *.* TO 'USER'@'%' WITH GRANT OPTION; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.5' | |
services: | |
database: | |
restart: unless-stopped | |
build: db | |
ports: | |
- 3306:3306/tcp | |
environment: | |
MYSQL_ROOT_PASSWORD: rootpassword | |
MYSQL_DATABASE: DBNAME | |
MYSQL_USER: USER | |
MYSQL_PASSWORD: password | |
volumes: | |
- db-vol:/PATH_TO_VOL/db-vol:rw | |
volumes: | |
db-vol: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment