mysql数据导出不完正_【MySQL】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了!
總結
以上是生活随笔為你收集整理的mysql数据导出不完正_【MySQL】mysqldump 导出数据 常见问题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php mysql 常用语句_PHP m
- 下一篇: go语言mysql操作_使用Go语言操作