Answer the question
In order to leave comments, you need to log in
What is wrong with my docker-compose?
I'm trying to create an additional database and an admin for it in one service of my docker-compose.
But there is a syntax error in the script... I fall asleep and don't see where))
version: "3.0"
services:
db:
image: mysql:5.7
restart: always
environment:
- MYSQL_ROOT_PASSWORD=rootpass
- MYSQL_USER=superroot
- MYSQL_PASSWORD=superpass123
- MYSQL_DATABASE=gitea
entrypoint:
sh -c "echo 'CREATE DATABASE IF NOT EXISTS nextcloud; CREATE USER 'tester'@'localhost' IDENTIFIED BY 'superpass123';\
GRANT ALL PRIVILEGES ON * . * TO 'tester'@'localhost'; 'FLUSH PRIVILEGES'; > /docker-entrypoint-initdb.d/init.sql;\
/usr/local/bin/docker-entrypoint.sh --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci"
#iiworks:
# - gitea
volumes:
- /var/lib/docker/volumes/mysql:/var/lib/mysql
ports:
- 3306:3306
Answer the question
In order to leave comments, you need to log in
HexUserHex is what you wrote in ENTRYPOINT try to run it and you will see problems with quotes around SQL.
e.g.
give
giveA = B
I think it's easier to copy init.sql to image instead of generating it every time you run it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question