add newline after each cmd in sqlCmd
This commit is contained in:
parent
b1f73641c8
commit
e9aee770e1
2
.vscode/numbered-bookmarks.json
vendored
2
.vscode/numbered-bookmarks.json
vendored
@ -5,7 +5,7 @@
|
|||||||
"bookmarks": [
|
"bookmarks": [
|
||||||
-1,
|
-1,
|
||||||
72,
|
72,
|
||||||
-1,
|
80,
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
|
@ -45,7 +45,7 @@ if [ -z "$(ls -A /var/lib/mysql/ 2> /dev/null)" ]; then
|
|||||||
|
|
||||||
# statement to create new SQL database
|
# statement to create new SQL database
|
||||||
printf "DB-CREATE: Generating SQL database create statement for '%s'\n" "$MYSQL_DATABASE"
|
printf "DB-CREATE: Generating SQL database create statement for '%s'\n" "$MYSQL_DATABASE"
|
||||||
printf "CREATE DATABASE IF NOT EXISTS \`%s\` CHARACTER SET %s COLLATE %s;" "$MYSQL_DATABASE" "$MYSQL_CHARSET" "$MYSQL_COLLATION" >> "$sqlCmd"
|
printf "CREATE DATABASE IF NOT EXISTS \`%s\` CHARACTER SET %s COLLATE %s;\n" "$MYSQL_DATABASE" "$MYSQL_CHARSET" "$MYSQL_COLLATION" >> "$sqlCmd"
|
||||||
|
|
||||||
# statements to:
|
# statements to:
|
||||||
# cleanup permissions:
|
# cleanup permissions:
|
||||||
@ -53,17 +53,17 @@ if [ -z "$(ls -A /var/lib/mysql/ 2> /dev/null)" ]; then
|
|||||||
# add root@% with password authentication
|
# add root@% with password authentication
|
||||||
# create SQL user if requested
|
# create SQL user if requested
|
||||||
# remove 'test' table
|
# remove 'test' table
|
||||||
printf 'USE mysql;' >> "$sqlCmd"
|
# //printf "USE mysql;\n" >> "$sqlCmd"
|
||||||
printf 'FLUSH PRIVILEGES;' >> "$sqlCmd"
|
printf "FLUSH PRIVILEGES;\n" >> "$sqlCmd"
|
||||||
printf "DB-CREATE: Generating SQL permissions statement for 'root@%%'\n"
|
printf "DB-CREATE: Generating SQL permissions statement for 'root@%%'\n"
|
||||||
printf "GRANT ALL ON *.* TO 'root'@'%%' IDENTIFIED BY '%s' WITH GRANT OPTION;" "$MYSQL_ROOT_PASSWORD" >> "$sqlCmd"
|
printf "GRANT ALL ON *.* TO 'root'@'%%' IDENTIFIED BY '%s' WITH GRANT OPTION;\n" "$MYSQL_ROOT_PASSWORD" >> "$sqlCmd"
|
||||||
if [ -n "$MYSQL_USER" ] && [ -n "$MYSQL_PASSWORD" ]; then
|
if [ -n "$MYSQL_USER" ] && [ -n "$MYSQL_PASSWORD" ]; then
|
||||||
printf "DB-CREATE: Generating SQL permissions statement for '%s'\n" "$MYSQL_USER"
|
printf "DB-CREATE: Generating SQL permissions statement for '%s'\n" "$MYSQL_USER"
|
||||||
printf "GRANT ALL ON \`%s\`.* TO '%s'@'%%' IDENTIFIED BY '%s';" "$MYSQL_DATABASE" "$MYSQL_USER" "$MYSQL_PASSWORD" >> "$sqlCmd"
|
printf "GRANT ALL ON \`%s\`.* TO '%s'@'%%' IDENTIFIED BY '%s';\n" "$MYSQL_DATABASE" "$MYSQL_USER" "$MYSQL_PASSWORD" >> "$sqlCmd"
|
||||||
fi
|
fi
|
||||||
printf "DB-CREATE: Generating statement to drop 'test' table\n"
|
printf "DB-CREATE: Generating statement to drop 'test' table\n"
|
||||||
printf 'DROP DATABASE IF EXISTS test;' >> "$sqlCmd"
|
printf "DROP DATABASE IF EXISTS test;\n" >> "$sqlCmd"
|
||||||
printf 'FLUSH PRIVILEGES;' >> "$sqlCmd"
|
printf "FLUSH PRIVILEGES;\n" >> "$sqlCmd"
|
||||||
|
|
||||||
# execute statements against mariadb and cleanup
|
# execute statements against mariadb and cleanup
|
||||||
printf "DB-CREATE: Bootstrapping mySQL database\n"
|
printf "DB-CREATE: Bootstrapping mySQL database\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user