1. Various usage instructions
A. The simplest use:
Copy Code code as follows:
Mysqldump-uroot-ppassword [Database name]
> [Dump file]
The above command backs up the specified database to a dump file (dump file), for example:
Copy Code code as follows:
mysqldump-uroot-p123 Test > Test.dump
The generated Test.dum
; db_name. SQL
It only requests the lock table at the beginning, then refreshes the binlog, and then adds the change master statement to the exported file to specify the binlog location of the current backup, if you want to restore the file to slave, you can use this method.
1.2 restore
The file backed up with mysqldump is an SQL script that can be directly imported. There are two ways to import data.
Directly use the mysql client
For
db_name> db_name. SQLIt only requests the lock table at the beginning, then refreshes the BINLOG, and then adds the change master statement to the exported file to specify the BINLOG location of the current backup, if you want to restore the file to slave, you can use this method.
1.2 restoreThe file backed up with mysqldump is an SQL script that can be directly imported. There are two ways to import data.Directly use the mysql clientFor
Mysql backup and database restoration mysqldump instance and parameter description mysqldump
BitsCN.com
We will certainly encounter the situation of backing up the database and restoring the database during the operation of the project. we generally use the following two methods to deal with it:
1. use into outfile and load data infile to import and export backup data
The advantage of this method is that th
We will certainly encounter the situation of backing up the database and restoring the database during the operation of the project. We generally use the following two methods to deal with it:
1. Use into outfile and load data infile to import and export backup data
The advantage of this method is that the exported data can be in the specified format and exported only data without table creation information. You can directly import different tables in the same database, it is more flexible than
Mysqldump backup and restoration of mysql data instance mysqldump
For mysql database backup and restoration, we generally use the following two methods:
1. use into outfile and load data infile to import and export backup data
The exported data can be in the specified format and exported as pure data without table creation information. you can directly import different tables in the same database, which i
log can be viewed using the following command:
Mysql> show variables like '% general_log_file % ';
Perform full-Database Backup
# Mysqldump -- master-data = 2-R -- single-transaction-A-phello> 3306_20160518. SQL
Where
-- Master-data: 2 indicates that the comment of change master is generated in the backup file. In this example
-- CHANGE MASTER TO MASTER_LOG_FILE='mysql2-bin.000049', MASTER_LOG_POS=587;
If
statements. For example, whether to restore data by appending or clearing data before adding data, etc:
For detailed usage, refer to the official mysqldump documentation.
Back up all databases:
mysqldump --all-databases > dump.sqlBack up multiple databases:
mysqldump --databases db1 db2 db3 > dump.sql
You can us
Mysql backup and database restoration mysqldump instance and parameter description mysqldump
We will certainly encounter the situation of backing up the database and restoring the database during the operation of the project. we generally use the following two methods to deal with it:
1. use into outfile and load data infile to import and export backup data
The advantage of this method is that the exporte
In MySQLDump, use the-w statement for backup. mysqldump-w
When we use mysqldump to back up data, we have the option-where/-w. You can specify the backup conditions. The options are described as follows:
-w, --where=name Dump only selected records. Quotes are mandatory
We can perform a test, for example:
are ignored, you need to repeat them multiple times, one table at a time. Each table must specify both the database and the table name. For example:--ignore-table=database.table1--ignore-table=database.table2 ... Mysqldump-uroot-p--host=localhost--all-databases--ignore-table=mysql.user --include-master-host-port The ' Change MASTER ' generated in--dump-slave Add ' master_host= in statement
requests the lock table at the very first moment, then refreshes the binlog, and then adds the change MASTER statement to the exported file to specify the Binlog location of the current backup, which can be done if you want to restore the file to slave.1.2 Restore
A file backed up with Mysqldump is a SQL script that can be poured directly, and there are two ways to import the data.
Directly with MySQL clientFor
Help information and exit. Mysqldump--help--hex-blob uses hexadecimal format to export binary string fields. This option must be used if you have binary data.
The field types affected are binary, VARBINARY, BLOB.
Mysqldump-uroot-p--all-databases--hex-blob--host,-H need to export the host information mysqldump-uroot-p--host=localhost--all-databases --ignore-tabl
MySQL -- When mysqldump, mysql -- mysqldump
Some production environments use mysqldump -- single-transaction to back up the database at night, while colleagues just execute the alter table operation during the backup. The operation partially succeeded and failed. Why?
In mysqldump, the single-transaction parameter is i
Mysqldump and mysqlbinlog, mysqldump1. mysqldump
1. Back up the test database
#mysqldump -uroot -p'123' test >test.sql
2. Backup-B Parameters
# Mysqldump-uroot-p '000000'-B test> test_ B. SQL -- B has the create DATABASE, and use
# Mysqldump-uroot-p '000000'-B test test
Label:Original http://www.cnblogs.com/xuejie/archive/2013/01/11/2856911.html We will certainly encounter the backup database in the course of running the project, restore the database situation, we generally use two ways to deal with: 1. Import and export backup data using into outfile and load data infile The advantage of this method is that the exported data can be self-defined format, and the export is pure data, there is no table information, you can directly import another database with the
-tableDo not export the specified table. When you specify to ignore multiple tables, you need to repeat multiple times for each table. The database and table names must be specified for each table. Example: -- ignore-table = database. table1 -- ignore-table = database. table2 ......Mysqldump-uroot-p -- host = localhost -- all-databases -- ignore-table = mysql. user-- Include-master-host-portIn the 'change m
command parameters, you can useCopy codeThe Code is as follows:Mysqldump -- help Command to view all the parameters in Mysqldump and their support.Example of Mysqldump Export command:After the Mysql database is installed, it contains the mysql database by default. I will use this database as an example to demonstrate various export instances of Mysqldump.Use
Error in mysqldump and error in mysqldump
When you use the mysqldump command to back up the entire database, the following error is returned:
Mysqldump: Couldn't execute 'show triggers like 'userlog'': Got error 28 from storage engine (1030)
View disk space
[Root @ localhost ~] # Df-hFile System capacity used available
Exports a binary string field using hexadecimal format. You must use this option if you have binary data.
The field types that are affected are binary, VARBINARY, and blobs. Mysqldump-uroot-p--all-databases--hex-blob--host,-H need to export the host information mysqldump-uroot-p--host=localhost--all-databases- -ignore-table does not export the specified table. Specifies that multiple tables are ignored, an
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.