summaryrefslogtreecommitdiff
path: root/scripts/create_mysql_user.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/create_mysql_user.sh')
-rw-r--r--scripts/create_mysql_user.sh10
1 files changed, 6 insertions, 4 deletions
diff --git a/scripts/create_mysql_user.sh b/scripts/create_mysql_user.sh
index 71c6169bfd0..6a11a9e12b1 100644
--- a/scripts/create_mysql_user.sh
+++ b/scripts/create_mysql_user.sh
@@ -1,7 +1,9 @@
#!/bin/bash
-mysql --user=root --host=127.0.0.1 <<EOF
-CREATE USER IF NOT EXISTS 'gitlab'@'127.0.0.1';
-GRANT ALL PRIVILEGES ON gitlabhq_test.* TO 'gitlab'@'127.0.0.1';
-FLUSH PRIVILEGES;
+if mysqladmin ping --user=root --host=127.0.0.1; then
+ mysql --user=root --host=127.0.0.1 <<EOF
+ CREATE USER IF NOT EXISTS 'gitlab'@'127.0.0.1';
+ GRANT ALL PRIVILEGES ON gitlabhq_test.* TO 'gitlab'@'127.0.0.1';
+ FLUSH PRIVILEGES;
EOF
+fi