当前位置:网站首页>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




边栏推荐
- Analysis and comparison of leetcode weekly race + acwing weekly race (t4/t3)
- 無心劍英譯席慕容《無怨的青春》
- C语音常用的位运算技巧
- [swagger]-swagger learning
- Introduction to the gtid mode of MySQL master-slave replication
- 视频网站手绘
- Roads and routes -- dfs+topsort+dijkstra+ mapping
- MySQL REGEXP:正则表达式查询
- Phpstrom setting function annotation description
- Intel sapphire rapids SP Zhiqiang es processor cache memory split exposure
猜你喜欢

Take you ten days to easily complete the go micro service series (IX. link tracking)

Talking about JVM 4: class loading mechanism

Actual combat simulation │ JWT login authentication

How to safely eat apples on the edge of a cliff? Deepmind & openai gives the answer of 3D security reinforcement learning

微信小程序;胡言乱语生成器

How to use words to describe breaking change in Spartacus UI of SAP e-commerce cloud
![[development of large e-commerce projects] performance pressure test - Optimization - impact of middleware on performance -40](/img/e4/0bdee782a65028b2bc87db85d48738.png)
[development of large e-commerce projects] performance pressure test - Optimization - impact of middleware on performance -40

After reading the average code written by Microsoft God, I realized that I was still too young

Delaying wages to force people to leave, and the layoffs of small Internet companies are a little too much!

Basic operations of database and table ----- delete index
随机推荐
ROS command line tool
Digital DP template
Basic operations of database and table ----- create index
Four pits in reentrantlock!
Basic operation of database and table ----- phased test II
实战模拟│JWT 登录认证
如果消费互联网比喻成「湖泊」的话,产业互联网则是广阔的「海洋」
[CTF] AWDP summary (WEB)
Yyds dry goods inventory kubernetes management business configuration methods? (08)
phpstrom设置函数注释说明
Async/await you can use it, but do you know how to deal with errors?
Chia Tai International Futures: what is the master account and how to open it?
Grabbing and sorting out external articles -- status bar [4]
Pycharm professional download and installation tutorial
Introduction to the gtid mode of MySQL master-slave replication
线上故障突突突?如何紧急诊断、排查与恢复
Complex, complicated and numerous: illustration of seven types of code coupling
Call Huawei order service to verify the purchase token interface and return connection reset
Classification of performance tests (learning summary)
Robley's global and Chinese markets 2022-2028: technology, participants, trends, market size and share Research Report