microservices-patterns / ftgo-application

Example code for the book Microservice patterns
Other
3.4k stars 1.31k forks source link

Image ftgo-application-mysql init sql error #181

Open tianzhen45 opened 8 months ago

tianzhen45 commented 8 months ago

In container ftgo-application-mysql /docker-entrypoint-initdb.d/0.configure-root-user.sh

#! /bin/bash

if [ -z "$MYSQL_ROOT_HOST" ] ; then
  MYSQL_ROOT_HOST=%
  echo defaulting MYSQL_ROOT_HOST=$MYSQL_ROOT_HOST
fi

cat >> /docker-entrypoint-initdb.d/5.configure-users.sql <<END
CREATE USER 'root'@'${MYSQL_ROOT_HOST}' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}';
GRANT ALL ON *.* TO 'root'@'${MYSQL_ROOT_HOST}' WITH GRANT OPTION ;
GRANT PROXY ON ''@'' TO 'root'@'${MYSQL_ROOT_HOST}' WITH GRANT OPTION ;"
END
...

GRANT PROXY ON ''@'' TO 'root'@'${MYSQL_ROOT_HOST}' WITH GRANT OPTION ;"

The line has an extra double quotation .

There is log error.

2024-01-03 16:37:13 mysql-1          | [Entrypoint] running /docker-entrypoint-initdb.d/5.configure-users.sql
2024-01-03 16:37:13 mysql-1          | ERROR 1064 (42000) at line 3: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"' at line 1