Skip to content

Instantly share code, notes, and snippets.

@JosePedroDias
Created May 10, 2022 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JosePedroDias/17a1e1c6e281010942144c9de71b61f3 to your computer and use it in GitHub Desktop.
Save JosePedroDias/17a1e1c6e281010942144c9de71b61f3 to your computer and use it in GitHub Desktop.
mysql 5.7 docker-composed
mysql -h localhost -u USER -P 3306 -p --protocol=TCP
FROM mysql/mysql-server:5.7.38
# place
ADD init-users.sql /docker-entrypoint-initdb.d/
ADD init-db.sql /docker-entrypoint-initdb.d/
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;
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