当前位置:网站首页>MySQL backup and recovery + experiment
MySQL backup and recovery + experiment
2022-07-05 01:28:00 【kiroct】
mysql Backup and recovery of
The importance of data backup
The main purpose of backup is disaster recovery
In the production environment , Data security is crucial
Any loss of data can have serious consequences
Cause of data loss
Program error
Human error
Arithmetic error
Disk failure
disaster ( Such as fire 、 The earthquake ) And theft
From the point of view of physics and logic , Backup can be divided into
The physical backup : Physical files for database operating system ( Such as data files 、 Log files, etc ) Backup of
Physical backup method
Cold backup ( Offline backup ) : It was done when the database was shut down
Hot backup ( Online backup ) : The database is running , Database dependent log files
Warm backup : Database lock table ( Not writable but readable ) Backup operation in the state of
Logical backup : For database logic components ( Such as : Database objects such as tables ) Backup of
From the perspective of database backup strategy , Backup can be divided into :
Full backup : Every time you make a full backup of the database
Differential backup : Back up files that have been modified since the last full backup
Incremental backup : Only files modified after the last full backup or incremental backup will be backed up 
Common backup methods
Physical cold standby
The database is closed at the time of backup , Directly package database files
Fast backup , Recovery is also the simplest
Special backup tool mydump or mysqlhotcopy
mysqldump Common logical backup tools
mysqlhotcopy Only have Backup MyISAM and ARCHIVE surface
Enable two - Perform incremental backup of hexadecimal logs
Incremental backup , Need to refresh binary log
Third party tools backup
Free of charge MySQL Hot backup software Percona XtraBackup
MySQL Full backup ( Definition )
■ For the entire database 、 Backup of database structure and file structure
■ What you save is the database at the time of backup completion
■ The difference between backup and incremental backup is
Physical cold backup and recovery
close MySQL database
Use tar Command to package the database folder directly
Replace existing directly MySQL directory
mysqldump Backup and recovery
MySQL Backup tools included , It is convenient to realize MySQL Backup of
You can add the specified library 、 The table is exported as SQL Script
Use command mysq| Import backup data
Back up the database completely
Case study 1: First create a database


mysql Full backup of
InnoDB The database of the storage engine is stored in three files on disk : db.opt ( Table properties file )、 Table name . frm( Table structure file )、 Table name .ibd( Table data file ).





mysql A complete recovery of
systemctl start mysqld
(1) Recover database
mysql -u root -p -e 'drop database kgc; ’
#“-e” Options , Used to specify the connection MySQL Command executed after , Automatically exit after the command is executed
mysql -u root -P -e 'SHOW DATABASES; ’
mysql -u root -p < /opt/kgc.sql
(2) Restore data table
When the backup file contains only the backup of tables , Without the statement of the created library , The library name must be specified when performing the import operation , And the target library must exist .
mysql Incremental logging and recovery
----MySQL Incremental backup ----








mysql Incremental recovery of




边栏推荐
- Implementation steps of master detail detail layout mode of SAP ui5 application
- Basic operation of database and table ----- the concept of index
- Behind the cluster listing, to what extent is the Chinese restaurant chain "rolled"?
- La jeunesse sans rancune de Xi Murong
- Great God developed the new H5 version of arXiv, saying goodbye to formula typography errors in one step, and mobile phones can also easily read literature
- FEG founder rox:smartdefi will be the benchmark of the entire decentralized financial market
- Database postragesq PAM authentication
- Hedhat firewall
- 無心劍英譯席慕容《無怨的青春》
- batchnorm. Py this file single GPU operation error solution
猜你喜欢

Express routing, express middleware, using express write interface

A simple SSO unified login design

小程序容器技术与物联网 IoT 可以碰撞出什么样的火花

流批一體在京東的探索與實踐

Great God developed the new H5 version of arXiv, saying goodbye to formula typography errors in one step, and mobile phones can also easily read literature

Phpstrom setting function annotation description
![[swagger]-swagger learning](/img/60/1dbe074b3c66687867192b0817b553.jpg)
[swagger]-swagger learning

小程序直播 + 电商,想做新零售电商就用它吧!

Database performance optimization tool

Postman automatically fills headers
随机推荐
Behind the cluster listing, to what extent is the Chinese restaurant chain "rolled"?
Heartless sword English translation of Xi Murong's youth without complaint
无心剑英译席慕容《无怨的青春》
抓包整理外篇——————状态栏[ 四]
Basic operations of database and table ----- delete index
Yyds dry goods inventory kubernetes management business configuration methods? (08)
Game 280 of leetcode week
Introduction to the gtid mode of MySQL master-slave replication
Chia Tai International Futures: what is the master account and how to open it?
如果消费互联网比喻成「湖泊」的话,产业互联网则是广阔的「海洋」
Redis(1)之Redis简介
142. Circular linked list II
What is the current situation and Prospect of the software testing industry in 2022?
Take you ten days to easily complete the go micro service series (IX. link tracking)
Single step debugging of master data reading of SAP commerce cloud products
Jcenter () cannot find Alibaba cloud proxy address
Wechat applet; Gibberish generator
RB technology stack
Database postragesql lock management
微信小程序:独立后台带分销功能月老办事处交友盲盒