Good afternoon.
I created a DB in MySQL with Pizzaria name. I've tried several ways to create DB backup but I did not succeed.
The last code I tried was:
try {
File file = new File("Backup");
file.mkdir();
String nomeBkp = tfDiretorio.getText() + ".sql";
System.out.println(nomeBkp);
String dump = "cmd.exe /c C:\MySQL\MySQL Workbench CE 6.1.6\mysqldump.exe --user=root --password=123456 pizzaria > Backup/" + nomeBkp;
Runtime bkp = Runtime.getRuntime();
bkp.exec(dump);
JOptionPane.showMessageDialog(rootPane, "Backup realizado com sucesso!");
} catch (IOException ex) {
JOptionPane.showMessageDialog(null, "Erro!" + ex.getMessage());
}