]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/cats/grant_mysql_privileges.in
Fix #1335 about postgresql error message during copy session
[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 db_user=${db_user:-@db_user@}
6 bindir=@SQL_BINDIR@
7 db_name=${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 ${db_user}@localhost;
12 grant all privileges on ${db_name}.* to ${db_user}@"%";
13 select * from user;
14 flush privileges;
15 END-OF-DATA
16 then
17    echo "Privileges for ${db_user} granted on ${db_name}."
18    exit 0
19 else
20    echo "Error creating privileges."
21    exit 1
22 fi