How do I backup a database that is running on phpMyAdmin through Java?
Thanks
one way is to have mysqldump
binary (from your mysql
installation files) in your project directory, and call it like:
StringBuilder sb = new StringBuilder("cmd /c mysqldump -h").append(HOSTNAME).append(" -u");
sb.append(UNAME).append(" -p").append(PASSWD).append(" ").append(DB_NAME);
for (String s : tableList) {
sb.append(" ").append(s);
}
sb.append(" > backup.sql");
try {
File file = new File("etc/");
Process pr = Runtime.getRuntime().exec(sb.toString(), null, file);
pr.waitFor();
} catch (IOException | InterruptedException ex) {
}