When you use mysqldump to back up MySQL, the backup file is a text file in SQL format, consisting of a series of CREATE TABLE and INSERT statements. When recovering, just use the SQL file as input to the MySQL program, as follows:
Mysqldump mydb mytbl > Mytbl.sql
MySQL MyDB
Note: Do not attempt to load the backup file generated by mysqldump with Mysqlimport!
A few days ago received a business project, MySQL database logical backup mysqldump backup failed mail, this is on vacation, but in the spirit of serious and responsible work, 7x24 hours of uninterrupted operation of the noble professional sentiment, began the DBA of the wrong way (start database backup is successful, The coincidence is that I have a vacation on the problem, suspicion is the data volume and growth.
First we understand a process of
mysqldump parameter Daquan These parameters are different from those of MySQL : 2 types of parameters mean something differently.Mysqldump parameter Daquan (parameter from mysql5.5.19 source)ParametersParameter description--all-databases,-AExport all databases.Mysqldump-uroot-p--all-databases--all-tablespaces, YExport all table spaces.Mysqldump-uroot-p--all-databases--all-tablespaces--no-tablespaces, YNo table space information is exported.Mysqldump
I stepped on a mine of mysqldump. mysqldump
Let's first look at two cases: P 1:
[21:56:33-root @ ssdtest :~ ] # Mysqldump-S/data/mysql/test_3306/mysql. sock -- single-transaction -- force -- databases tpcc> v1. SQL
P 2:
[21:56:54-root @ ssdtest :~ ] # Mysqldump-S/data/mysql/test_3306/mysql. sock -- single-transac
Tags: mysqldump mysql mysql backupMySQL backup mysqldumpNote: Backup files and binary log files cannot be placed on the same disk as MySQLNode 11, modify the MySQL configuration file on Node 1, open binary log SaveHere I put the binary log in the/data/mysql/directory,/data/is the other LVM disk I created, I would like to put in the/data/, I found that I could not start MySQL, so it is recommended to put in the/data/mysql[Email protected] ~]# mkdir-pv/
Although MySQL logical backup often due to lock table and other defects are criticized, in fact, in the downtime window time, if the amount of data is not too high, do a logical backup is quite simple ~Preparatory work:1. Target repository (back up data from this library) first to have sufficient permissions to the account (the temporary root can be used to delete the end);2. The corresponding tool should be installed, such as Mydumper;3. Prepare the script/command, don't worry about it in the t
the data imported from the other end. We will not discuss various data export methods in other databases. You will learn how to use MySQL to export data.
Use mysqldump:
(The mysqldump command is located in the mysql/bin/directory)
Mysqldump is similar to the opposite tool in many aspects. They have the same options. However,
Mysqldump
Mysql provides the msyqldump tool to export the database.
After searching for articles on the Internet, most of them are from one article, with a wide range of contents. Most of them are not used.
I sorted out some of the options I used and found useful, and recorded them below.
The basic format of mysqldump is:
Mysqldump-hhost-Pport-uuser-ppassword d
Use mysqldump to export databases.
First, I met a database named mydb,
There are two tables, mytable and mytabletwo.
Both tables have data.
C: \ Program Files \ mysql \ MySQL Server 5.1 \ bin> mysqldump-uroot-proot-D mydb> C:/KUjiegou. SQL// Export the structure of all tables in the specified database.(Specifically, drop before create)
C: \ Program Files \ mysql \ MySQL Server 5.1 \ bin>
Tags: linux mysql backupMysqldump Backup Instructions:#mysqldump-uroot-p123456 Test > Test.sql
#mysqldump-uroot-p123456-b Test > Test.sql #这两个的差别 :-B The database name that will be created is also backed up
#mysqldump-uroot-p123456-b Test | gzip > test.sql.gz Backup Library and compressmysqldump Principle of Backup:is actually the data from the MySQL library in
, ' Test 001 '), (2, ' Test 002 '), (4, ' Test 004 '), (5, ' Test 005 '); UNLOCK TABLES; "Specify Character Set backup (export) when backing up" "This will not be garbled when checking the exported database, the specified character set is the character set of the database table""Restore the backed up data while checking the recovered data"[Email protected]/]# mysql-uroot-poldboy123 Oldboy "plus-b backup Database"[Email protected] ~]#
MySQL mysqldump is used for export. The basic usage is as follows:Shell> mysqldump [OPTIONS] database [tables]If you do not specify any tables, the entire database will be exported.Run mysqldump -- help to obtain the option table supported by your mysqldump version.Note: If you run
Mysqldump-uroot-p111111-q-e-R-x -- databasesaccountgame_s1game_s2 ...... d: backup. SQL # self-used backup parameters for your reference. For more use of mysqldump, refer to blog. csdn. netallen_aarticledetails51330658-quick,-q this option is useful when exporting large tables
Mysqldump-uroot-p111111-q-e-R-x -- databases account game_s1 game_s2 ...... d: \ backup
Use mysqldump for Mysql backup mysqldump
1. mysqldump command
Mysql mysqldump is used for MySQL database export. The basic usage is as follows:
Shell> mysqldump [OPTIONS] database [tables]
If you do not specify any tables, the entire database will be exported.
Run
To export the Mysqldump tool to use with MySQL, the basic usage is:Shell>[OPTIONS]database[tables] If you do not give any tables, the entire database will be exported.By executing mysqldump--help, you can get a list of options supported by your mysqldump version.Note that if you run mysqldump without the--quick or--op
Tags: Export file Microsoft Jas Black Dump directory RAC http present out CTEhttp://c.biancheng.net/cpp/html/1458.html The mysqldump command is used to back up the database. The mysqldump command executes under the DOS [Url=file://\\mysql\\bin]\\mysql\\bin[/url] directory. 1) Export the entire database (the export file is present in the Mysql\bin directory by default)??
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.