I used following JAVA code for write a backup file of MySQL database, but when I run this code there is no backup created. What is the problem with this ?
public void writeBackup(String date, int x) throws IOException, InterruptedException
{
Runtime runTime = Runtime.getRuntime();
Process runtimeProcess = runTime.exec("mysqldump Healthplus -h localhost -u root -pmysql -r D:/HealthplusBackups/Healthplus" + date + ".sql");
}
The mysqldump command should read
mysqldump -f --opt --user=root --password=mysql --databases Healthplus > D:/HealthplusBackups/Healthplus" + date + ".sql
However it assumes you have access to the folder on the D drive, and it will also do a force dump so if there are any errors it should continue.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.