Skip to content

Commit

Permalink
Handle the comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vmcj committed Oct 21, 2023
1 parent 8634336 commit bc51b99
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sql/dj_setup_database.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ verbose()

usage() {
cat <<EOF
Usage: $0 [option]... <command>
Usage: $0 [option]... <command> [argument]
Commands:
status check database installation status
Expand All @@ -35,8 +35,8 @@ Commands:
install-examples install examples only
install-loadtest configure for load testing. WARNING: CREATES A LOT OF EXTRA ITEMS!
upgrade upgrade MySQL database schema to current version
dump backup the current database to file (without .tar.gz suffix)
load load a backup from file (without.tar.gz suffix). REMOVES ALL PREVIOUS DATA!
dump [filename] backup the current database to file (without .tar.gz suffix)
load [filename] load a backup from file (without.tar.gz suffix). REMOVES ALL PREVIOUS DATA!
Options:
-u <user> connect to MySQL with DB admin <user>
Expand Down Expand Up @@ -215,13 +215,15 @@ create_db_users()
# The MySQL character set and collation are hardcoded here, but
# can be changed in the database and their configuration settings
# in etc/domserver-config.php updated after installation.
local mysql_options
mysql_options="${DBA_USER:+-u ${DBA_USER}} ${DBA_PASSWORD:+-p ${$DBA_PASSWORD}}"
echo "CREATE DATABASE IF NOT EXISTS \`$DBNAME\` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"

echo "CREATE USER IF NOT EXISTS '$domjudge_DBUSER'@'localhost' IDENTIFIED BY '$domjudge_PASSWD';"
echo "GRANT SELECT, INSERT, UPDATE, DELETE ON \`$DBNAME\`.* TO '$domjudge_DBUSER'@'localhost';"

echo "FLUSH PRIVILEGES;"
) | mysql
) | mysql $mysql_options
verbose "DOMjudge database and user(s) created."
}

Expand Down

0 comments on commit bc51b99

Please sign in to comment.