Mysqldump using--set-gtid-purged

Source: Internet
Author: User

1. Specify the character set when exporting, error character set ' Utf-8 ' is not a compiled character set and are not specifie.
--default-character-set=utf-8

This is because the character set is wrong. It's--default-character-set=utf8.

2, the export prompts Warning,a partial dump from A server, which has Gtids

[[email protected] data]# mysqldump-Uroot--master-data=2-p--single-transaction--databases test >3.sqlEnter password:warning:a PartialDump  fromA server that has gtids'll by defaultInclude the Gtids of  AllTransactions, even those that changed suppressed parts ofTheDatabase.IfYou don't want to restore gtids, pass--set-gtid-purged=off. To make a complete dump, pass--all-databases--triggers--routines--events. 

With regard to GTID is 5.6, the global transaction ID (GTID) is added to harden the database's primary and standby consistency, fault recovery, and fault tolerance.
Official: A global transaction identifier (GTID) is a unique identifier created and associated with each transaction committed On the origin (master) of the server.
So it may be because it is unique within a database, but it is possible to duplicate it when importing other libraries. All will have a reminder.

You can set these two parameters by adding--set-gtid-purged=off or –gtid-mode=off.
Personally, the Gtid is re-produced in the import library instead of the original.

[[email protected] data]# mysqldump-Uroot--master-data=2-p--single-transaction--databases test >3.sqlEnter password:warning:a PartialDump  fromA server that has gtids'll by defaultInclude the Gtids of  AllTransactions, even those that changed suppressed parts ofTheDatabase.IfYou don't want to restore gtids, pass--set-gtid-purged=off. To make a complete dump, pass--all-databases--triggers--routines--events.
[email protected] data]# cat 3.sql
--MySQL dump 10.13 distrib 5.6.28, for Linux (x86_64)----host:localhost database:test------------------------ ----------------------------------Server version 5.6.28-debug-log/*!40101 SET @[email protected] @CHARACTER_SET_CLIE NT */;/*!40101 set @[email protected] @CHARACTER_SET_RESULTS */;/*!40101 set @[email protected] @COLLATION_CONNECTION */ ;/*!40101 set NAMES UTF8 */;/*!40103 set @[email protected] @TIME_ZONE */;/*!40103 set time_zone= ' +xx:xx' */;/*!40014 set @[email protected] @UNIQUE_CHECKS, unique_checks=0 */;/*!40014 set @[email protected] @FOREIGN_KEY_ CHECKS, foreign_key_checks=0 */;/*!40101 SET @[email protected] @SQL_MODE, sql_mode= ' No_auto_value_on_zero ' */;/*! 40111 SET @[email protected] @SQL_NOTES, sql_notes=0 */; SET @MYSQLDUMP_TEMP_LOG_BIN = @ @SESSION. Sql_log_bin; SET @ @SESSION. sql_log_bin= 0;----GTID State at the beginning of the backup--SET @ @GLOBAL. Gtid_purged= ' 42FE5059-32A7-11E6-9D29-000C29FCECDA:1';----Position to start replication or point-in-time recovery from----change MASTER to master_log_file= '1.000003', master_log_pos=358;----Current database: ' Test '--create database/*!32312 IF not exists*/' test '/*!40100 DEFAULT CHAR Acter SET GBK */; Use ' test ',----table structure for table ' t '--drop table IF EXISTS ' t ';/*!40101 SET @saved_cs_client = @ @character_se T_client */;/*!40101 SET character_set_client = UTF8 */; CREATE TABLE ' t ' (' A ' char (4) default NULL) engine=innodb default charset=latin1;/*!40101 SET character_set_client = @sa Ved_cs_client */;----dumping data for table ' t '--lock TABLES ' t ' write;/*!40000 ALTER table ' t ' DISABLE KEYS */;insert in To ' t ' VALUES ('?? '), (' abc ');/*!40000 ALTER TABLE ' t ' ENABLE KEYS */; UNLOCK TABLES;----table structure for table ' T1 '--drop table IF EXISTS ' t1 ';/*!40101 SET @saved_cs_client = @ @charact Er_set_client */;/*!40101 Set character_set_client = UTF8 */; CREATE TABLE ' t1 ' (' A ' char (4) default NULL) engine=memory default charset=latin1;/*!40101 SET character_set_client = @s aved_cs_client * *;----dumping data for table ' T1 '--lock TABLES 'T1 ' write;/*!40000 alter TABLE ' t1 ' DISABLE keys */;/*!40000 ALTER table ' t1 ' ENABLE KEYS */; UNLOCK TABLES; SET @ @SESSION. Sql_log_bin = @MYSQLDUMP_TEMP_LOG_BIN;/*!40103 Set [Email protected]_time_zone */;/*!40101 set [email  Protected]_sql_mode */;/*!40014 Set [email protected]_foreign_key_checks */;/*!40014 set [email protected] _unique_checks */;/*!40101 Set [email protected]_character_set_client */;/*!40101 set [email protected]_ Character_set_results */;/*!40101 Set [email protected]_collation_connection */;/*!40111 set [email  Protected]_sql_notes */;--Dump completed on 2016-07-20 8:01:38

does not increase  GLOBAL. gtid_purged  Variable
[[email protected] data] - -- master-data=2-  p  --set-gtid-purged=off --databases test >3.sql

Export database Test in T-table DB1 table1

[[email protected] data] - -- master-data=2-  p  --single-transaction--set-gtid-purged=off test T >3.sql

Specify test, TEST1 the export of the database--databases DB1 DB2

[[email protected] data] - -- master-data=2-  p  --single-transaction--set-gtid-purged=off--databases test test1 >3.sql

Fully prepared database--all-databases

[[email protected] data] - -- master-data=2-  p  --single-transaction--set-gtid-purged=off  --all-databases

Large data volume backup-q

[[email protected] data] - -- master-data=2-  p  --single-transaction-q--set-gtid-purged=off Test T  >3.sql

Mysqldump using--set-gtid-purged

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.