db_user=${db_user:-@db_user@}
bindir=@SQL_BINDIR@
db_name=${db_name:-@db_name@}
+db_password=@db_password@
+if [ "$db_password" != "" ]; then
+ pass="identified by '$db_password'"
+fi
if $bindir/mysql $* -u root -f <<END-OF-DATA
use mysql
-grant all privileges on ${db_name}.* to ${db_user}@localhost;
-grant all privileges on ${db_name}.* to ${db_user}@"%";
+grant all privileges on ${db_name}.* to ${db_user}@localhost ${pass};
+grant all privileges on ${db_name}.* to ${db_user}@"%" ${pass};
select * from user;
flush privileges;
END-OF-DATA
db_user=${db_user:-@db_user@}
bindir=@SQL_BINDIR@
db_name=${db_name:-@db_name@}
+db_password=@db_password@
+if [ "$db_password" != "" ]; then
+ pass="password '$db_password'"
+fi
+
$bindir/psql -f - -d ${db_name} $* <<END-OF-DATA
-create user ${db_user};
+create user ${db_user} ${pass};
-- for tables
grant all on unsavedfiles to ${db_user};