3 # shell script to grant privileges to the bacula database
6 # Bacula® - The Network Backup Solution
8 # Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
10 # The main author of Bacula is Kern Sibbald, with contributions from many
11 # others, a complete list can be found in the file AUTHORS.
13 # You may use this file and others of this release according to the
14 # license defined in the LICENSE file, which includes the Affero General
15 # Public License, v3.0 ("AGPLv3") and some additional permissions and
16 # terms pursuant to its AGPLv3 Section 7.
18 # Bacula® is a registered trademark of Kern Sibbald.
20 db_user=${db_user:-@db_user@}
22 db_name=${db_name:-@db_name@}
23 db_password=@db_password@
24 if [ "$db_password" != "" ]; then
25 pass="identified by '$db_password'"
28 if $bindir/mysql $* -u root -f <<END-OF-DATA
30 grant all privileges on ${db_name}.* to ${db_user}@localhost ${pass};
31 grant all privileges on ${db_name}.* to ${db_user}@"%" ${pass};
36 echo "Privileges for user ${db_user} granted on database ${db_name}."
39 echo "Error creating privileges."