Detailed discussion on the issue of mysqldump data export

Detailed discussion on the issue of mysqldump data export

1. An error (1064) is reported when using mysqldump. This is because the mysqldump version is too old and inconsistent with the current database version.

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 //Or log in to mysql, select version(); You can also view the version
Server version: 5.6.25 -log Source distribution
. . . . .

In this case, you must know the absolute path of mysqldump, which is in the mysql installation directory.

2. Specify the character set when exporting, and an error will be reported

Character set 'utf-8' is not a compiled character set and is not specified.
--default-character-set=utf-8

This is because the character set is wrong. Yes --default-character-set=utf8

3. Warning when exporting: 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.

Regarding GTID, after 5.6, the global transaction ID (GTID) was added to enhance the master-slave consistency, fault recovery, and fault tolerance of the database.
Official: A global transaction identifier (GTID) is a unique identifier created and associated with each transaction committed on the server of origin (master).
So it may be because it is unique in one database, but it may be duplicated when imported into other libraries. There will be a reminder for all.

This can be set by adding the following two parameters: --set-gtid-purged=off or --gtid-mode=OFF.

It is very likely that the GTID is regenerated in the import library instead of the original one.

[root@bastion-IDC ~]# mysqldump -uroot --set-gtid-purged=off -p xqsj_db > xqsj_db20160811.sql #That's it!

The above article discusses the problem of mysqldump data export in detail. This is all the content that the editor shares with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • Detailed explanation of MySQL mysqldump command usage
  • How to use mysqldump to backup and restore specified tables
  • Detailed explanation of using mysqldump to export data from MySQL database
  • mysql mysqldump data backup and incremental backup
  • Detailed explanation of mysqldump database backup parameters
  • Things to note when backing up data with mysqldump plus the -w parameter
  • mysql backup and restore mysqldump.exe several common use cases
  • How to use mysqldump to backup MySQL data

<<:  js to implement verification code interference (dynamic)

>>:  Nginx location matching rule example

Recommend

How to pull the docker image to view the version

To view the version and tag of the image, you nee...

About deploying a web project to Alibaba Cloud Server (5 steps to do it)

1. First log in to the Alibaba Cloud website to r...

mysql server is running with the --skip-grant-tables option

The MySQL server is running with the --skip-grant...

How to install Nginx in CentOS

Official documentation: https://nginx.org/en/linu...

JavaScript color viewer

This article example shares the specific code of ...

Notes on upgrading to mysql-connector-java8.0.27

Recently, an online security scan found a vulnera...

Detailed examples of how to use the box-shadow property in CSS3

There are many attributes in CSS. Some attributes...

How to create a my.ini file in the MySQL 5.7.19 installation directory

In the previous article, I introduced the detaile...

Example usage of JavaScript tamper-proof object

Table of contents javascript tamper-proof object ...

Detailed explanation of MySQL 5.7.9 shutdown syntax example

mysql-5.7.9 finally provides shutdown syntax: Pre...

MySQL 5.7.16 ZIP package installation and configuration tutorial

This article shares the installation and configur...

Step by step guide to build a calendar component with React

Table of contents Business Background Using Techn...

Write a formal blog using XHTML CSS

The full name of Blog should be Web log, which mea...