当前位置:网站首页>Mysql database compressed backup_ Summary of MySQL backup compression and database recovery methods
Mysql database compressed backup_ Summary of MySQL backup compression and database recovery methods
2022-06-25 14:01:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
Generally, we pass mysqldump To backup MySQL data library , And upload to other backup machines . If the database is large , The backup transmission may be slow , So we try to make the backup file smaller .
When writing an automatic backup script , It is better to compress the backup results directly , You can also recover directly from a compressed backup . How to use bzip2 and gzip Compress mysql Backup file .
Backup and use bzip Compress :
The code is as follows
mysqldump | bzip2 > outputfile.sql.bz2
from bzip2 Backup recovery :
The code is as follows
bunzip2 < outputfile.sql.bz2 | mysql < mysql options>
Backup and use gzip Compress :
The code is as follows
mysqldump | gzip > outputfile.sql.gz
from gzip Backup recovery :
gunzip < outputfile.sql.gz | mysql < mysql options>
Supplement this article
Back up the specified database
The code is as follows
mysqldump -h hostname -u username -p databasename > db.sql If the path is not specified explicitly, it is assigned to the user's working directory :C:Documents and SettingsAdministrator
You can specify the backup directory explicitly :
The code is as follows
mysqldump -u root -p mydb -h 192.168.14.204 > D:mydb.sql
explain :
-p After that, you don't need to enter a password , You need to enter the password after clicking the Enter key .
Direct will MySQL Database compression backup
The code is as follows
mysqldump -h hostname -u username -p databasename | gzip > db.sql.gz
explain :
gzip yes linux Compressor under , So in windows It can't be used in the environment .
Backup MySQL A database ( some ) surface
The code is as follows
mysqldump -h hostname -u username -p databasename table1 table2 > db.sql
Backup multiple files at the same time MySQL database
The code is as follows
mysqldump -h hostname -u username -p –databases db1 db2 db3 > dbs.sql
Back up all databases on the server
The code is as follows
mysqldump –all-databases > allbackupfile.sql
test :
The code is as follows
mysqldump –all-databases -u root -p > allbackupfile.sql
Enter password: ******windows You can use Mysql Query Browser Of File–》Open Script To execute the backup script , You can also use the following command to restore directly :
The code is as follows
mysql -h hostname -u username -p databasename < backupfile.sql
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/151705.html Link to the original text :https://javaforall.cn
边栏推荐
- Rust, le meilleur choix pour un programmeur de démarrer une entreprise?
- 专家建议|8大措施加速你的创新职业规划和成长
- Windows下MySQL的安装和删除
- Cesium learning notes
- On the realization of guessing numbers game
- Openstack learning notes -grace component insight
- Deep parsing and implementation of redis stream advanced message queue [10000 words]
- shell 内置命令
- [open source Hongmeng system display] the rk3568 development board is equipped with openharmony 3.1 release
- 算力&NFT交易平台F3.xyz旗下独家权益NFT项目Hash Eagle将盛大发行
猜你喜欢

Nr-arfcn and channel grid, synchronous grid and GSCN

戴尔电脑cpu温度过高怎么办

On the realization of guessing numbers game

解决报错:Creating window glfw ERROR: GLEW initalization error: Missing GL version

NR-ARFCN和信道栅格、同步栅格和GSCN

How does hash eagle, the founder of equity NFT, redefine NFT and use equity to enable long-term value?

Where can the brightness of win7 display screen be adjusted

shell 内置命令

数据采集系统网关采集工厂效率

Pourquoi les programmeurs devraient - ils être plus doux?
随机推荐
Windows下MySQL的安装和删除
Application of tactile intelligent sharing-rk3568 in financial self-service terminal
Rust, le meilleur choix pour un programmeur de démarrer une entreprise?
Beego--- notes
Untiy force refresh UI
shell 变量 入门
Error1822 and error1824 are displayed in the database
Implementation of a small book system
關於一道教材題的講解
sql导入这样怎么解决
Use of bind() in JS and handwritten bind()
Scope of ES6 variable
Asp. Net webform exporting excel using npoi
历史上的今天:网易成立;首届消费电子展召开;世界上第一次网络直播
Typescript and go --- essence
shell 字符串变量
Syntax 'trap'
Suanli & NFT trading platform f3 The exclusive NFT project of XYZ, hash eagle, will be grandly launched
Graph contractual learning with augmentations
NVM installation and use tutorial