Skip to content

Commit bb2c877

Browse files
authored
Merge pull request #32 from thelamer/master
#31 need to use backticks to support special characters in DB names
2 parents 3500ca6 + 3d21602 commit bb2c877

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

root/etc/cont-init.d/40-initialise-db

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,18 @@ if [ "${MYSQL_USER+x}" ] && \
5050
[ "${MYSQL_PASSWORD+x}" ] && \
5151
[ "${#MYSQL_PASSWORD}" -gt "4" ]; then
5252
read -r -d '' MYSQL_DB_SETUP << EOM
53-
CREATE DATABASE ${MYSQL_DATABASE};
53+
CREATE DATABASE \`${MYSQL_DATABASE}\`;
5454
CREATE USER '${MYSQL_USER}'@'%' IDENTIFIED BY '${MYSQL_PASSWORD}';
55-
GRANT ALL PRIVILEGES ON ${MYSQL_DATABASE}.* TO '${MYSQL_USER}'@'%';
55+
GRANT ALL PRIVILEGES ON \`${MYSQL_DATABASE}\`.* TO '${MYSQL_USER}'@'%';
5656
EOM
5757
fi
5858

5959
# add rest of sql commands based on password set or not
6060
cat >> "$tempSqlFile" <<-EONEWSQL
61-
$MYSQL_DB_SETUP
6261
$MYSQL_PASS
6362
GRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION ;
6463
DROP DATABASE IF EXISTS test ;
64+
$MYSQL_DB_SETUP
6565
EONEWSQL
6666
echo "Setting Up Initial Databases"
6767

0 commit comments

Comments
 (0)