]> git.sur5r.net Git - bacula/bacula/commitdiff
Explicitly create MySQL user in grant_mysql_privileges.in
authorKern Sibbald <kern@sibbald.com>
Wed, 13 Jul 2016 08:41:45 +0000 (10:41 +0200)
committerKern Sibbald <kern@sibbald.com>
Wed, 13 Jul 2016 08:41:45 +0000 (10:41 +0200)
bacula/src/cats/grant_mysql_privileges.in

index ab85680ade1b2af6d40db16a739cbacfe08651b3..f19eac11a241181ca219c8f3abfd77a953e8a46f 100644 (file)
@@ -2,7 +2,7 @@
 #
 # shell script to grant privileges to the bacula database
 #
-# Copyright (C) 2000-2015 Kern Sibbald
+# Copyright (C) 2000-2016 Kern Sibbald
 # License: BSD 2-Clause; see file LICENSE-FOSS
 #
 db_user=${db_user:-@db_user@}
@@ -17,6 +17,14 @@ if [ "$db_ssl_options" != "" ]; then
    ssl_options="require $db_ssl_options"
 fi
  
+if $bindir/mysql $* -u root -f 2>/dev/null 1>/dev/null <<EOD
+use mysql;
+create user ${db_user} ${pass};
+EOD
+then
+  echo "Created MySQL database user: ${db_user}"
+fi
+
 if $bindir/mysql $* -u root -f <<END-OF-DATA
 use mysql
 grant all privileges on ${db_name}.* to ${db_user}@localhost ${pass} ${ssl_options};