程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> 關於MYSQL數據庫 >> 詳談mysqldump數據導出的問題

詳談mysqldump數據導出的問題

編輯:關於MYSQL數據庫

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數據導出的問題就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved