mvc备份mysql_mysql的备份与还原(爬坑之旅)

0.前言

开发中经常能用到mysql,为了防止数据丢失,备份还原是基本操作,本文主要讲解mysql数据库的备份还原,用到的工具,Navicat 15。百度了方法,但是实际操作还是遇到了一些问题。

1.方式一:SQL文件

找到我们要备份的数据库,右击数据库,选择“存储SQL文件”

0e7e0a8a4508a371e64b9b535a9c35f2.png

然后等待它一点点导出,注意,到如下界面后,点击“关闭”就行,不用再次点击开始了。

b8aa6e4f4ab8cc75d790331426a22f02.png

这样就导出成功了,然后我们在别的地方新建一个数据库。如果建库过程中遇到”1044-Access denied for user ‘xxx’ @’127.0.0.1′ to database ‘test’”请点击这里解决。

新建数据库过程中,字符集在导出的sql文件中有说明,可以按照导出的文件填写。

ec85964f8c374d5041ae553b1813d769.png

新建完数据库后,双击选中数据库,然后右击我们新建的数据库,选择“运行SQL语句”

dbd116f9dc6ddbed684bf8e2c54ff476.png

然后选中刚才导出的SQL文件,

78767846a75a7bd79dd50d16ef9ef50f.png

如果你点击开始,就会开始执行sql语句,但是这个可能会有问题,比如下面这个,错误太多,主要是因为我们在上面过程中,勾选了“遇到错误时继续”,然后在创建数据库的时候遇到错误就直接跳过了。

26ed87f7d5af750bc3ea87b62aacce9f.png

如果你不勾选的话,就需要手动修改,很麻烦。后面统一说解决办法。

2.备份还原功能

navicat有备份还原功能,选中我们要备份的那个数据库,点击“备份”—>”新建备份“

4beabf61079f26d139299d9d1c9761cb.png

要从数据库A备份到数据库B

注释随便填,然后点击“备份”

47b64297570a53d74cf6cfa1217cdd87.png

到下面这个界面,表示备份完成。

c57578b4f17299099d494f6037ce296b.png

然后我们还是新建一个数据库B,右击“备份”,通过“在文件夹中显示”,我们把数据库A中的备份数据,复制到数据库B的目录下。

693627ca339e6ec70d5ed1dc1831767b.png

我们选中要还原的数据,点击"还原备份"

7d867e79052a6ab5adf8eae0ed3fc0fb.png

遇到下面这个图,点击“还原”

%E5%A4%87%E4%BB%BD6.png

遇到下面这个“successully”,点击“关闭“

2b5a35c1c6cc7718f2009059a323ed66.png

3.遇到的问题及解决办法

在实际操作中,遇到很多问题,比如还原的时候一堆报错,经过实际操作中,主要是因为两个mysql的版本不一致,把要备份的数据库和要还原的数据库版本统一。另外,用方法二的成功概率比方法一的高,实际操作中建议使用方法二。

如果用方法二还是出现【Err】,可以把这些出错的表单独复制。

返回目录:开发与创造

Post Views:

28

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Legal Notice Copyright © 2017 Veritas Technologies LLC. All rights reserved. Veritas and the Veritas Logo are trademarks or registered trademarks of Veritas Technologies LLC or its affiliates in the U.S. and other countries. Other names may be trademarks of their respective owners. This product may contain third party software for which Veritas is required to provide attribution to the third party (“Third Party Programs”). Some of the Third Party Programs are available under open source or free software licenses. The License Agreement accompanying the Software does not alter any rights or obligations you may have under those open source or free software licenses. Please see the Third Party Legal Notice Appendix to this Documentation or TPIP ReadMe File accompanying this product for more information on the Third Party Programs. The product described in this document is distributed under licenses restricting its use, copying, distribution, and decompilation/reverse engineering. No part of this document may be reproduced in any form by any means without prior written authorization of Veritas Technologies LLC and its licensors, if any. THE DOCUMENTATION IS PROVIDED "AS IS" AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID. VERITAS TECHNOLOGIES LLC SHALL NOT BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES IN CONNECTION WITH THE FURNISHING, PERFORMANCE, OR USE OF THIS DOCUMENTATION. THE INFORMATION CONTAINED IN THIS DOCUMENTATION IS SUBJECT TO CHANGE WITHOUT NOTICE. The Licensed Software and Documentation are deemed to be commercial computer software as defined in FAR 12.212 and subject to restricted rights as defined in FAR Section 52.227-19 "Commercial Computer Software - Restricted Rights" and DFARS 227.7202, et seq. "Commercial Computer Software and Commercial Computer Software Documentation," as applicable, and any successor regulations, whether delivered by Veritas as on premises or hosted services. Any use, modification, reproduction release, performance, display or disclosure of the Licensed Software and Documentation by the U.S. Government shall be solely in accordance with the terms of this Agreement.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值