MySQL备份问题 [英] MySQL backup problem
本文介绍了MySQL备份问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好gyus!
我正在使用sqldump使用以下代码来备份我的sql数据库:
其中final path = destination path
和名称
Hello gyus!
I am using sqldump to take backup of my sql database using code bellow:
where final path = destination path
and name
String cmd = "mysqldump -u"+databaseUserName+" "+"-p"+databasePassword
+" "+databaseName+" "+"-r"+finalPath+".sql";
Process run = Runtime.getRuntime().exec(cmd);
int complete = run.waitFor();
if (complete == 0)//return zero if sucess full
{
//if process is sucess full
statuse_lbl.setText("Opration Successfull...!");
} else {
String completeTime =dateFormat.format(calender.getTime());
//if process is not sucessfull
do something
}
现在的问题是,当我在分区C:\或E:\上进行备份时,它是成功的,但是当我尝试在其他目录i-e C:\backup or C:\someFolder or E:\someFolder
上进行备份时,它将失败.
请帮我解决这个问题.
谢谢
Now problem is that when i take backup on partition C:\ or E:\ it is successful, But when i try to take backup on further directory i-e C:\backup or C:\someFolder or E:\someFolder
Then it fails.
Please help me to solve this problem.
Thanks
推荐答案
您遇到的错误类型请提及.
做一件事,将所有代码块放入try ... catch块中,看看错误
What type of error u are getting please mention.
Do one thing put all that block of code in try...catch block and see the error
是否尝试打印出命令字符串,并查看它是否可以运行(如果只是粘贴)在控制台中启动它?我的猜测是某些字符(例如"\")可能必须在控制台上转义...
干杯,阿恩特
Have you tried to print out the command-String and see whether it runs if you just paste it in a console and start it? My guess would be that some chars (eg. "\") might have to be escaped on the console...
Cheers, Arndt
这篇关于MySQL备份问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文