diff --git a/sql/dj_setup_database.in b/sql/dj_setup_database.in index 5c33c965e1..792a25e017 100755 --- a/sql/dj_setup_database.in +++ b/sql/dj_setup_database.in @@ -23,7 +23,7 @@ verbose() usage() { cat < +Usage: $0 [option]... [argument] Commands: status check database installation status @@ -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 connect to MySQL with DB admin @@ -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." }