详谈mysqldump数据导出的问题
2019/6/30 18:20:56
本文主要是介绍详谈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 --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了!
以上这篇详谈mysqldump数据导出的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持找一找教程网。
这篇关于详谈mysqldump数据导出的问题的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-04-26MySQL查出时间比实际晚8小时的解决方案
- 2024-04-01JPA不识别MySQL的枚举类型
- 2024-03-30mysql数据库表卡死解决方法
- 2024-03-15MySQL多数据源笔记5-ShardingJDBC实战
- 2024-03-11natural join mysql
- 2024-03-11关于VS2017,VS2015 中利用 EF使用Mysql 不显示数据源问题解决方案
- 2024-02-26mysql 阿里云xb后缀备份文件恢复-icode9专业技术文章分享
- 2024-02-22docker mysql 5.7
- 2024-02-18从 20 多套 MySQL 到 1 套 TiDB丨骏伯网络综合运营管理平台应用实践
- 2024-02-07mysql 外键索引入门介绍,为什么工作中很少有人使用?