简体   繁体   English

如何在winforms中定期自动备份MySql数据库?

[英]How to auto backup MySql database periodically in winforms?

In winforms application I want to backup my database once for every week. 在winforms应用程序中,我想每周备份一次数据库。 How can i do this. 我怎样才能做到这一点。 Can it be done through Coding or should I go for batch file? 可以通过编码完成,还是应该去批处理文件? And the backup must be done automatically with out any user interface.. 并且备份必须在没有任何用户界面的情况下自动完成。

You could do it either way. 您可以选择任何一种方式。

If you write a batch file, you can have the Windows Scheduler run this file once a week. 如果编写批处理文件,则可以让Windows Scheduler每周运行一次此文件。

Either way, you must make sure the database is closed before running the backup. 无论哪种方式,都必须在运行备份之前确保数据库已关闭。 This may be easier with code. 使用代码可能更容易。

Use the Copy method of the System.IO.File class. 使用System.IO.File类的Copy方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM