]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/cats/grant_mysql_privileges.in
bf89fe060ad3a567daad37078498bb1209bfb4c2
[bacula/bacula] / bacula / src / cats / grant_mysql_privileges.in
1 #!/bin/sh
2 #
3 # shell script to grant privileges to the bacula database
4 #
5 USER=@db_user@
6 bindir=@SQL_BINDIR@
7 db_name=@db_name@
8
9 if $bindir/mysql $* -u root -f <<END-OF-DATA
10 use mysql
11 grant all privileges on ${db_name}.* to ${USER}@localhost;
12 grant all privileges on ${db_name}.* to ${USER}@"%";
13 select * from user;
14 flush privileges;
15 END-OF-DATA
16 then
17    echo "Privileges for ${USER} granted on ${db_name}."
18    exit 0
19 else
20    echo "Error creating privileges."
21    exit 1
22 fi