• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

详解mysqldump数据导出的问题

mysql 搞代码 4年前 (2022-01-09) 23次浏览 已收录 0个评论

下面小编就为大家带来一篇详谈mysqldump数据导出的问题。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧

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 --versionmysqldump 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.sqlWarning: 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).
所以可能是因为在一个数据库里面唯一,但是当导入其他的库就有可能重复。所有会有一个提醒。

可以通过添加–本文来源gao@daima#com搞(%代@#码@网&set-gtid-purged=off 或者–gtid-mode=OFF这两个参数设置。

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

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

以上就是详解mysqldump数据导出的问题的详细内容,更多请关注搞代码gaodaima其它相关文章!


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:详解mysqldump数据导出的问题

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址