詳談mysqldump數(shù)據(jù)導(dǎo)出的問(wèn)題
1,使用mysqldump時(shí)報(bào)錯(cuò)(1064),這個(gè)是因?yàn)閙ysqldump版本太低與當(dāng)前數(shù)據(jù)庫(kù)版本不一致導(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的絕對(duì)路徑,在mysql的安裝目錄下有。
2,導(dǎo)出時(shí)指定字符集,報(bào)錯(cuò)
Character set 'utf-8' is not a compiled character set and is not specifie .
--default-character-set=utf-8
這個(gè)是因?yàn)樽址e(cuò)了。是--default-character-set=utf8
3,導(dǎo)出時(shí)提示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) 來(lái)強(qiáng)化數(shù)據(jù)庫(kù)的主備一致性,故障恢復(fù),以及容錯(cuò)能力。
官方給的:A global transaction identifier (GTID) is a unique identifier created and associated with each transaction committed on the server of origin (master).
所以可能是因?yàn)樵谝粋€(gè)數(shù)據(jù)庫(kù)里面唯一,但是當(dāng)導(dǎo)入其他的庫(kù)就有可能重復(fù)。所有會(huì)有一個(gè)提醒。
可以通過(guò)添加--set-gtid-purged=off 或者–gtid-mode=OFF這兩個(gè)參數(shù)設(shè)置。
很有肯能是在導(dǎo)入庫(kù)中重新生產(chǎn)GTID,而不用原來(lái)的。
[root@bastion-IDC ~]# mysqldump -uroot --set-gtid-purged=off -p xqsj_db > xqsj_db20160811.sql #這樣就ok了!
以上這篇詳談mysqldump數(shù)據(jù)導(dǎo)出的問(wèn)題就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
MySQL創(chuàng)建用戶以及用戶權(quán)限詳細(xì)圖文教程
在MySQL中可以通過(guò)創(chuàng)建用戶來(lái)管理數(shù)據(jù)庫(kù)的訪問(wèn)權(quán)限,下面這篇文章主要給大家介紹了關(guān)于MySQL創(chuàng)建用戶以及用戶權(quán)限的相關(guān)資料,文中通過(guò)圖文介紹的非常詳細(xì),需要的朋友可以參考下2024-06-06MySQL獲取binlog的開(kāi)始時(shí)間和結(jié)束時(shí)間(最新方法)
這篇文章主要介紹了MySQL如何獲取binlog的開(kāi)始時(shí)間和結(jié)束時(shí)間,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2023-05-05

MySQL 8.2 Command Line Client打開(kāi)時(shí)一閃而過(guò)閃退問(wèn)題

深入研究mysql中的varchar和limit(容易被忽略的知識(shí))