Http://blog.chinaunix.net/u/29134/showart_287899.html
Note: If you use mysqldump, you must have at least select and lock tables permissions. Database or table.
If you want to use the -- tab switch, you must have the file permission.
Preparations:
Databases and tables:
Table CREATE TABLE-----------------------------------------------Pwss create table 'pwss '('Id' int (11) not null auto_increment,'Username' varchar (64) default null,'Descripti
I. Backup Type and other description: 1.1 whether the server will continue to provide service points during Backup:
Hot Backup: read/write during Backup is not affected
Warm backup: only read operations can be performed during Backup
Cold backup: Also called offline backup. All read/write operations are aborted.
Different storage engines also have different backup support. MyISAM storage engine can use the LVM snapshot function to implement hot backup. If there is no LVM, only warm backup c
This article mainly introduces the mysqldump command for importing and exporting database methods and instance summary. if you need it, refer to the usage of mysqldump command.
1. export all databases
System command line
Mysqldump-uusername-ppassword -- all-databases> all. SQL
2. import all databases
Mysql command line
Mysql> source all. SQL;
3. export some data
When using mysqldump to back up MySQL, the backup file is a text file in SQL format, which consists of a series of create table and insert statements. When restoring, you only need to use the SQL file as the input of the mysql program, as shown below:
Mysqldump mydb mytbl> mytbl. SQLMysql mydb
Note: do not try to use mysqlimport to load the backup file generated by mys
:
mysqldump--single-transaction--flush-logs--master-data=2 > Backup.sql
This generates an incremental binary log file, such as mysql-bin.000003, to recover the data as follows:
Shell> mysql-uroot-ppwd
In addition Mysqlbinlog can also specify--start-date 、--stop-date 、--start-position and--stop-position parameters, Used to recover data accurately before a certain point in time or to skip the middle of a problem period of reco
The mysqldump command creates a logical backup, and the result set has two formats: one is to convert data into standard SQL statements (a bunch of CREATE, DROP, INSERT, and other statements ), the other is
The mysqldump command creates a logical backup, and the result set has two formats: one is to convert data into standard SQL statements (a bunch of CREATE, DROP, INSERT, and other statements ), the other
Mysql master-slave synchronization error solution: This article is fromLinux O M training for Old BoysSummary of internal teaching plan contentFAQ: Question 1: mysqldump: Got error: 1556: You can't use locks with log tables.
When the old boy took the students to master the synchronization practice, he found that the following problems could not be solved during the students' practice. Therefore, the old boy summarized the solution process as follows:
Mysqldump Export Command Base usage
The code is as follows
Copy Code
Mysqldump-u username-P [--opt] DATABASENAME [Table] > Export SQL file name
The default mysqldump exported SQL file contains not only the exported data, but also the structure information of all the data tables in the exported database
1. Export the entire
Label:The command format is as follows:Mysqldump-u User name-p password database name table name--where= "filter Condition" > Export file pathExample:Export sensorid=11 and fieldid=0 data from the Sdata table in the Meteo database to/home/xyx/temp.sql this file mysqldump-uroot-p123456 Meteo sdata--where= "sensorid=11 and fieldid=0" >/home/xyx/temp.sql The following are some of the usage parameters of mysqldump
procedures and stored functions for the specified library;--triggers: Backs up triggers for specified libraries;-E,--events:--master-data[=#] 1: recorded as Ch ANGE Master to statement, this statement is not commented; 2: Record as change MASTER to statement, this statement is commented;--flush-logs: After the lock table is completed, the log refresh operation is performed;Example:Test environment:h1:centos7.3,mariadb5.5,192.168.32.111h2:centos7.3,mariadb5.5,192.168.32.112Steps:1. install a dat
MySQL has two backup methods for mysqldump backup and direct copy of data files. But the direct copy method has the disadvantage of not having a strong portability, when you use a direct backup method, you must ensure that the table is not used. The advantage is that it is appropriate to back up large data files.
The advantages of mysqldump backup: the ability to migrate to other machines, even on machines
databaseMysql-hhostname-uusername-ppassword DatabaseName Restore a compacted MySQL databaseGunzip To transfer a database to a new serverMysqldump-uusername-ppassword DatabaseName | Mysql–host=*.*.*.*-C DatabaseName
Mysqldump supports the following options:–add-locksAdd lock tables before each table is exported and then unlock table. (To make it faster to insert into MySQL).–add-drop-tableAdd a drop t
MySQL's "bug" about timestamp and mysqldump
BitsCN.com
MySQL's "bug" about timestamp and mysqldump"
Recurrence
The problem that a colleague encountered when performing a data dump is simplified as follows:
1. create a table
Drop table if exists tb;
Create table tb (
C timestamp not null default '2017-00-00 00:00:00'
) ENGINE = InnoDB default charset = gbk;
Insert into tb values (now ());
Select * from tb;
--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-uroot-p--all-databases--no-tablespaces--add-drop-databaseAdd drop DATABASE statements before each database is created.Mysqldump-uroot-p--all-databases--add-drop-database--add-drop-tableAdd Drop data table statements before each data table is created. (The default is o
Tags: Big data work name enable hex definition instead of Export request In the daily operations, the backup of MySQL database is extremely important, in case the database table is lost or corrupted, can recover the data in time. On-line Database backup scenario:Perform a full backup every Sunday, and then perform a mysqldump incremental backup every 1 o'clock in the afternoon. Below is a detailed description of this backup scenario:1.
Mysqldump Import and Export MySQL database 2011-02-21 16:33
Basic import of database \ Export command is mysqldump and sourceIn Linux under the direct command line operation can under Windows under normal circumstances there are two ways one is to use the command line another is to use phpMyAdminFirst of all, phpmyadmin. This tool is simple to export and import without having to build a lib
Export the Mysqldump tool that you want to use with MySQL, basic usage: Shell> mysqldump [OPTIONS] database [tables] If you do not give any tables, the entire database will be exported. By executing mysqldump--help, you can get the options table supported by your mysqldump version. Note that if you run
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
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.