简体   繁体   English

如何备份MySQL数据库?

[英]How to backup a MySQL database?

I have an account on an organizational MySQL server that is about to expire. 我在即将到期的组织MySQL服务器上有一个帐户。 I have a couple of databases on this server and would like to know how to backup (mirror) the their schemas and all data in them to my local hard drive (not to another MySQL server because I'd rather not have to set one up). 我在此服务器上有几个数据库,想知道如何将其架构和其中的所有数据备份(镜像)到我的本地硬盘驱动器(而不是另一个MySQL服务器,因为我宁愿不必设置一个) )。 Is there a free tool that I can use to do this backup quickly and easily? 我有免费的工具可以快速方便地进行备份吗? (It has to support connecting securely and over an SSH connection.) Thanks for your help. (它必须支持通过SSH连接进行安全连接。)感谢您的帮助。

是的, MySQLdump

mysqldump -u your-username -p database_name > filename

This is exactly the sort of thing that mysqldump is intended for. 这恰恰是mysqldump的目的。 Just SSH into the server, run mysqldump, and scp off your output file. 只是SSH连接到服务器,运行的mysqldump和scp关闭输出文件。

You could manually SSH to the server and run a mysqldump, but I don't think that's what you're asking about. 您可以手动SSH到服务器并运行mysqldump,但是我不认为这是您要的。

Personally, I'd use a program like SQLyog on Windows or Sequel Pro on Mac. 就个人而言,我会使用Windows上的SQLyog或Mac上的Sequel Pro之类的程序。 Both support SSH tunneling and both have a very easy interface for mysql backups/exports. 两者都支持SSH隧道传输,并且都具有用于mysql备份/导出的非常简单的界面。

您可以使用mysqldump来完成工作。

In the control panel lookup for database tools, lick mysqladmin. 在控制面板中查找数据库工具,单击mysqladmin。 Once you are there, you can back up a table, an entire database or what ever you want. 在那里,您可以备份表,整个数据库或任何您想要的文件。 There are checkbooks like do you want to export database structure only or the data too. 有一些支票簿,例如您只想导出数据库结构还是要导出数据。 There is bunch of options there, all GUI based. 那里有很多选项,全部基于GUI。 Please explore, you do not need command line. 请探索,您不需要命令行。

Once you are done exporting, you can import them again using the same GUI features. 导出完成后,可以使用相同的GUI功能再次导入它们。 There are someone in Privilages tab if I remember them correctly. 如果我没有记错的话,“特权”选项卡中会有人。

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

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