详谈mysqldump数据导出的问题

作者:jingxian 时间:2024-01-21 19:35:29 

1,使用mysqldump时报错(1064),这个是因为mysqldump版本太低与当前数据库版本不一致导致的。

mysqldump: Couldn't execute 'SET OPTION SQL_QUOTE_SHOW_CREATE=1': You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_QUOTE_SHOW_CREATE=1' at line 1 (1064)

[root@bastion-IDC ~]# mysqldump --version
mysqldump Ver 10.13 Distrib 5.1.61, for redhat-linux-gnu (x86_64)

[root@bastion-IDC ~]# mysql           //或者登陆mysql,select version();也可查看版本
Server version: 5.6.25-log Source distribution
。。。。。

这样的话必须知道mysqldump的绝对路径,在mysql的安装目录下有。

2,导出时指定字符集,报错

Character set 'utf-8' is not a compiled character set and is not specifie .
--default-character-set=utf-8

这个是因为字符集错了。是--default-character-set=utf8

3,导出时提示warning,A partial dump from a server that has GTIDs

[root@bastion-IDC ~]# mysqldump -uroot -p xqsj_db > xqsj_db20160811.sql
Warning: A partial dump from a server that has GTIDs will by default include the GTIDs of all transactions, even those that
changed suppressed parts of the database. If you don't want to restore GTIDs, pass --set-gtid-purged=OFF. To make a complete
dump, pass --all-databases --triggers --routines --events.

关于GTID是5.6以后,加入了全局事务 ID (GTID) 来强化数据库的主备一致性,故障恢复,以及容错能力。
官方给的:A global transaction identifier (GTID) is a unique identifier created and associated with each transaction committed on the server of origin (master).
所以可能是因为在一个数据库里面唯一,但是当导入其他的库就有可能重复。所有会有一个提醒。

可以通过添加--set-gtid-purged=off 或者–gtid-mode=OFF这两个参数设置。

很有肯能是在导入库中重新生产GTID,而不用原来的。

[root@bastion-IDC ~]# mysqldump -uroot --set-gtid-purged=off -p xqsj_db > xqsj_db20160811.sql                      #这样就ok了!

标签:mysql,dump,导出数据
0
投稿

猜你喜欢

  • 如何用python批量发送工资条邮件

    2021-03-07 10:53:09
  • 5个css+div导航菜单

    2011-04-29 12:38:00
  • PHP 正则表达式验证中文的问题

    2024-04-10 10:56:56
  • 教你pycharm运行Django第一个项目

    2021-08-25 16:40:07
  • python基于物品协同过滤算法实现代码

    2021-06-23 21:56:16
  • 详解python metaclass(元类)

    2023-08-21 10:09:04
  • MySQL实时监控工具orztop的使用介绍

    2024-01-13 18:15:17
  • 如何才能保护好我们的SQL Server数据库

    2009-01-08 13:37:00
  • 深入理解Vue 的条件渲染和列表渲染

    2024-04-09 10:46:37
  • Python3.7中安装openCV库的方法

    2021-07-07 04:23:32
  • Python jieba库分词模式实例用法

    2023-12-09 23:40:42
  • Python 从一个文件中调用另一个文件的类方法

    2022-02-22 23:36:35
  • python+requests+unittest API接口测试实例(详解)

    2021-10-14 13:15:08
  • Jupyter notebook如何修改平台字体

    2022-03-21 13:37:59
  • python 爬取知乎回答下的微信8.0状态视频

    2022-09-11 15:17:57
  • nodejs+mysql实现用户相关的增删改查的详细操作

    2024-01-26 10:34:45
  • MySQL修改root账号密码的方法

    2024-01-28 07:25:46
  • JS弹出可拖拽可关闭的div层完整实例

    2024-04-19 09:50:56
  • Python3 hashlib密码散列算法原理详解

    2021-07-06 12:59:55
  • 体验DW MX 2004 CSS新功能

    2011-06-14 09:45:01
  • asp之家 网络编程 m.aspxhome.com