Skip to content

Instantly share code, notes, and snippets.

@broland07
Created October 5, 2022 16:53
Show Gist options
  • Save broland07/9d3255e708015ae0d876047adfdfdde5 to your computer and use it in GitHub Desktop.
Save broland07/9d3255e708015ae0d876047adfdfdde5 to your computer and use it in GitHub Desktop.
mysql docker with init scripts
CREATE DATABASE IF NOT EXISTS `one`;
CREATE DATABASE IF NOT EXISTS `two`;
CREATE DATABASE IF NOT EXISTS `three`;
version: '3'
services:
mysql:
image: mysql:5.7
volumes:
- ./data/db:/var/lib/mysql
- ./init:/docker-entrypoint-initdb.d
command: --sql_mode=""
stop_grace_period: 1m30s
ports:
- 3306:3306
restart: always
environment:
MYSQL_ROOT_PASSWORD: securepassword
CREATE USER 'remote'@'%' IDENTIFIED BY 'remote';
GRANT ALL ON *.* TO 'remote'@'%';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment