mirror of
https://github.com/sameersbn/docker-gitlab.git
synced 2026-01-25 14:08:09 +00:00
init: replace -uroot with -u ${DB_USER} in the mysql commands
This commit is contained in:
parent
b6aa5bf526
commit
78078b08a4
@ -280,7 +280,7 @@ if [ "${DB_HOST}" == "localhost" ]; then
|
||||
|
||||
# wait for mysql server to start (max 120 seconds)
|
||||
timeout=120
|
||||
while ! mysqladmin -uroot ${DB_PASS:+-p$DB_PASS} status >/dev/null 2>&1
|
||||
while ! mysqladmin -u ${DB_USER} ${DB_PASS:+-p $DB_PASS} status >/dev/null 2>&1
|
||||
do
|
||||
timeout=$(expr $timeout - 1)
|
||||
if [ $timeout -eq 0 ]; then
|
||||
@ -290,10 +290,10 @@ if [ "${DB_HOST}" == "localhost" ]; then
|
||||
sleep 1
|
||||
done
|
||||
|
||||
if ! mysql -uroot ${DB_PASS:+-p$DB_PASS} -e "USE ${DB_NAME};" >/dev/null 2>&1; then
|
||||
if ! mysql -u ${DB_USER} ${DB_PASS:+-p $DB_PASS} -e "USE ${DB_NAME};" >/dev/null 2>&1; then
|
||||
DB_INIT="yes"
|
||||
mysql -uroot ${DB_PASS:+-p$DB_PASS} -e "CREATE DATABASE IF NOT EXISTS \`${DB_NAME}\` DEFAULT CHARACTER SET \`utf8\` COLLATE \`utf8_unicode_ci\`;"
|
||||
mysql -uroot ${DB_PASS:+-p$DB_PASS} -e "GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON \`${DB_NAME}\`.* TO 'root'@'localhost';"
|
||||
mysql -u ${DB_USER} ${DB_PASS:+-p $DB_PASS} -e "CREATE DATABASE IF NOT EXISTS \`${DB_NAME}\` DEFAULT CHARACTER SET \`utf8\` COLLATE \`utf8_unicode_ci\`;"
|
||||
mysql -u ${DB_USER} ${DB_PASS:+-p $DB_PASS} -e "GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON \`${DB_NAME}\`.* TO 'root'@'localhost';"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user