如何在 Windows 上安排远程 mysql 备份

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2306823/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 13:59:34  来源:igfitidea点击:

How to schedule remote mysql backups on windows

mysqlwindowswindows-xpbackup

提问by Industrial

I am looking for a smart way to take care of scheduling backups on a remote Mysql Unix/Linux server from my own personal Windows XP computer.

我正在寻找一种聪明的方法来从我自己的个人 Windows XP 计算机上安排远程 Mysql Unix/Linux 服务器上的备份。

Is there any (free if possible, preferable of course) software that i can schedule that logs in to a mysql database and downloads a complete backup?

是否有任何(如果可能,免费,当然最好)软件,我可以安排登录到 mysql 数据库并下载完整备份?

Would also need an alternative that might handle backups for databases that I don't have remote access to.

还需要一个替代方案来处理我无法远程访问的数据库的备份。

Thanks!

谢谢!

回答by GmonC

I'm supposing you have permission in your external host for these operations. That said, you have two approaches:

我假设您在外部主机中拥有这些操作的权限。也就是说,您有两种方法:

Using the mysqldump of your Windows MySql installation and a bat script for scheduling

使用 Windows MySql 安装的 mysqldump 和用于调度的 bat 脚本

If you have wamp/lamp/etc installed on your windows machine, you can use mysqldump in a bat file and set windows scheduler to call it everyday at 0:00 AM.

如果您的 Windows 机器上安装了 wamp/lamp/etc,您可以在 bat 文件中使用 mysqldump 并将 Windows 调度程序设置为每天早上 0:00 调用它。

Create a .bat file containing: (Make sure that your output directory is writable for this task in Win Vista and 7):

创建一个包含以下内容的 .bat 文件:(确保您的输出目录在 Win Vista 和 7 中可用于此任务):

set DATET=%date:~-4%_%date:~7,2%
"c:\xampplite\mysql\bin\mysqldump" --host="YOUR_HOST" --user="YOUR_USER" --password="YOUR_PASSWORD" YOUR_DB > "c:\"backup_%DATET%_YOUR_DB.sql
pause

...and set a task in your windows scheduler to call this bat everyday.

...并在您的 Windows 调度程序中设置一个任务来每天调用这个蝙蝠。

If you need additional parameters to your backup, don't forget to check mysqldump reference.

如果您的备份需要其他参数,请不要忘记检查mysqldump 参考

Using a "full-blown" software based backup solution

使用“成熟的”基于软件的备份解决方案

Check Mysql's solution directory. The only free solution I know of this list is the app from topsoftbut I haven't tested it. You could check Sourceforgeas well.

检查Mysql 的解决方案目录。我知道这个列表的唯一免费解决方案是来自topsoft的应用程序,但我还没有测试过它。您也可以检查Sourceforge

回答by p.marino

Have you looked at pmbp?

你看过pmbp吗?

It's web-based (PHP) and among the other features, it lists:

它是基于 Web (PHP) 的,除其他功能外,它列出了:

  • backup of one or several databases with or without data, table structure, ...
  • three types of compression (no compression, gzip or zip)
  • scheduled backups (by a small PHP script which must be included in an existing PHP script)
  • interface for managment of the backups (viewing, restoring, downloading, deleting)
  • backup directly onto FTP server and sending of backups by email
  • platform independent - only webserver and PHP needed to run e.g. on MS Windows, Linux or Mac
  • shell mode (to use manually or by cron script)
  • backup of whole file directories (on a FTP server).
  • backup databases from different accounts on several MySQL servers
  • one installation can be used for all MySQL users of one MySQL server (used by webhosters)
  • highest security through two alternative login methods (HTTP or HTML authentication)
  • 备份一个或多个数据库,包含或不包含数据、表结构、...
  • 三种压缩类型(无压缩、gzip 或 zip)
  • 计划备份(通过必须包含在现有 PHP 脚本中的小型 PHP 脚本)
  • 备份管理界面(查看、恢复、下载、删除)
  • 直接备份到 FTP 服务器并通过电子邮件发送备份
  • 独立于平台 - 仅需要在 MS Windows、Linux 或 Mac 上运行的网络服务器和 PHP
  • shell 模式(手动或通过 cron 脚本使用)
  • 备份整个文件目录(在 FTP 服务器上)。
  • 从多个 MySQL 服务器上的不同帐户备份数据库
  • 一个安装可以用于一台 MySQL 服务器的所有 MySQL 用户(由 webhosters 使用)
  • 通过两种替代登录方法(HTTP 或 HTML 身份验证)实现最高安全性

回答by Wim

I'm usually doing this from a Linux box, but you can do the same if you have Cygwin (or just the SSH executable) on your Windows machine:

我通常在 Linux 机器上执行此操作,但如果您的 Windows 机器上有 Cygwin(或仅 SSH 可执行文件),您也可以这样做:

ssh [email protected] "mysqldump dbname | gzip -9" > localfile.sql.gz