1,使用mysqldump時報(bào)錯(1064),這個是因?yàn)閙ysqldump版本太低與當(dāng)前數(shù)據(jù)庫版本不一致導(dǎo)致的。
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
。。。。。
這樣的話必須知道m(xù)ysqldump的絕對路徑,在mysql的安裝目錄下有。
2,導(dǎo)出時指定字符集,報(bào)錯
Character set 'utf-8' is not a compiled character set and is not specifie .
--default-character-set=utf-8
這個是因?yàn)樽址e了。是--default-character-set=utf8
3,導(dǎo)出時提示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.
關(guān)于GTID是5.6以后,加入了全局事務(wù) ID (GTID) 來強(qiáng)化數(shù)據(jù)庫的主備一致性,故障恢復(fù),以及容錯能力。
官方給的:A global transaction identifier (GTID) is a unique identifier created and associated with each transaction committed on the server of origin (master).
所以可能是因?yàn)樵谝粋€數(shù)據(jù)庫里面唯一,但是當(dāng)導(dǎo)入其他的庫就有可能重復(fù)。所有會有一個提醒。
可以通過添加--set-gtid-purged=off 或者–gtid-mode=OFF這兩個參數(shù)設(shè)置。
很有肯能是在導(dǎo)入庫中重新生產(chǎn)GTID,而不用原來的。
[root@bastion-IDC ~]# mysqldump -uroot --set-gtid-purged=off -p xqsj_db > xqsj_db20160811.sql #這樣就ok了!
以上這篇詳談mysqldump數(shù)據(jù)導(dǎo)出的問題就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。
您可能感興趣的文章:- Windows下實(shí)現(xiàn)MySQL自動備份的批處理(復(fù)制目錄或mysqldump備份)
- MySQL數(shù)據(jù)遷移使用MySQLdump命令
- mysql備份腳本 mysqldump使用方法詳解
- 詳解 linux mysqldump 導(dǎo)出數(shù)據(jù)庫、數(shù)據(jù)、表結(jié)構(gòu)
- 淺談mysqldump使用方法(MySQL數(shù)據(jù)庫的備份與恢復(fù))
- 8種手動和自動備份MySQL數(shù)據(jù)庫的方法
- linux實(shí)現(xiàn)mysql數(shù)據(jù)庫每天自動備份定時備份
- 詳解Mysql自動備份與恢復(fù)的幾種方法(圖文教程)
- CentOS系統(tǒng)下如何設(shè)置mysql每天自動備份
- Centos7中MySQL數(shù)據(jù)庫使用mysqldump進(jìn)行每日自動備份的編寫