如何在Windows上备份MySQL数据库?

发布于 2024-09-25 21:20:49 字数 147 浏览 1 评论 0原文

我的笔记本电脑上安装了 WampServer 2.0。

我正在其上运行我编写的应用程序。该应用程序正在使用 MySQL 数据库。

我想定期备份该数据库。

如何做到这一点?

如何在 Windows 上定义 cron ?

I have WampServer 2.0 that is installed on Windows on my laptop.

I'm running on it an application that I wrote. The application is working with MySQL database.

I would like to make backups of this database periodically.

How this can be done ?

How could I define cron on Windows ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

束缚m 2024-10-02 21:20:49

对于 Windows,crontab -e 的大致等效项是 at 命令,如下所示:

at 22:00 /every:M,T,W,Th,F C:\path\to\mysql\bin\mysqldump.exe ...

单独运行 at 命令会列出您已执行的任务使用 at 创建。

mysqldump 文档位于此处

The rough equivalent of crontab -e for Windows is the at command, as in:

at 22:00 /every:M,T,W,Th,F C:\path\to\mysql\bin\mysqldump.exe ...

Running the at command by itself lists the tasks you've created using at.

The mysqldump documentation is here.

柏林苍穹下 2024-10-02 21:20:49

备份 MySQL 数据库最流行的方法是使用 mysqldump:

  1. 打开 Windows 命令行。

  2. 指定 mysqldump 实用程序的目录

    cd "C:\Program Files\MySQL\MySQL Server 5.7\bin"

  3. 创建 MySQL 数据库的转储。

mysqldump.exe --user=YourUserName --password=YourPassword --host=localhost --port=3306 --result-file="Pathdump.sql" --databases "DatabaseName"

另外,还有有很多第三方工具,可以定期自动进行MySQL备份。

The most popular way to backup MySQL database is to use mysqldump:

  1. Open a Windows command line.

  2. Specify the directory to mysqldump utility

    cd "C:\Program Files\MySQL\MySQL Server 5.7\bin"

  3. Create a dump of your MySQL database.

mysqldump.exe --user=YourUserName --password=YourPassword --host=localhost --port=3306 --result-file="Pathdump.sql" --databases "DatabaseName"

Also, there are a lot of third-party tools, which can perform MySQL backups automatically on a regular basis.

卷耳 2024-10-02 21:20:49

您可以使用 bash 脚本。

#!/bin/sh
mysqldump -uroot -ppwd --opt db1 > /sqldata/db1.sql
mysqldump -uroot -ppwd --opt db2 > /sqldata/db2.sql

cd /sqldata/
tar -zcvf sqldata.tgz *.sql
cd /scripts/
perl emailsql.pl

http://paulbradley.tv/38/

You could use a bash script.

#!/bin/sh
mysqldump -uroot -ppwd --opt db1 > /sqldata/db1.sql
mysqldump -uroot -ppwd --opt db2 > /sqldata/db2.sql

cd /sqldata/
tar -zcvf sqldata.tgz *.sql
cd /scripts/
perl emailsql.pl

http://paulbradley.tv/38/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文