-
Notifications
You must be signed in to change notification settings - Fork 3
/
mysql-build.xml
19 lines (18 loc) · 946 Bytes
/
mysql-build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?xml version="1.0"?>
<project name="mysql" description="Handle mysql tasks" default="">
<target name="db:backup"
description="Make MySQL backup for ${databases} in ${dir}.">
<property name="options" value=""/>
<mkdir dir="${dir}" />
<tstamp />
<exec command="mysqldump -u${mysql.user} -p${mysql.passwd} ${options} --databases ${databases} > ${dir}/backup-${DSTAMP}.sql"/>
</target>
<target name="db:user:add"
description="Add a new MySQL ${user} identified with ${passwd}.">
<exec command="echo "CREATE USER '${user}'@'localhost' IDENTIFIED BY '${passwd}';"| mysql -u${mysql.user} -p${mysql.passwd}"/>
</target>
<target name="db:user:remove"
description="Remove MySQL ${user} identified with ${passwd}.">
<exec command="echo "DROP USER '${user}'@'localhost';"| mysql -u${mysql.user} -p${mysql.passwd}"/>
</target>
</project>