当前位置:网站首页>Mysql database backup command -- mysqldump
Mysql database backup command -- mysqldump
2022-04-23 18:14:00 【The hunter is eating meat】
List of articles
mysqldump explain
Default mysqldump Derived SQL In file , It not only contains the exported data , It also includes the export of all data tables in the database structural information .
in addition , Use mysqldump Derived SQL If the file does not have an absolute path , The default is to save in bin In the catalog .
1、mysql Configuration information
Database address :127.0.0.1
Database user name :root
Database password :pass
Database name :myweb
2、 Backup
Back up the database to D Disk and directory
mysqldump -h127.0.0.1 -uroot -ppass myweb > d:/backupfile.sql
Back up to the current directory Backup MySQL The database is in the form of deleted tables , The backup can overwrite the existing database without manually deleting the original database
mysqldump --add-drop-table -h127.0.0.1 -uroot -ppass myweb > backupfile.sql
Direct will MySQL Database compression backup Backup to D Disk and directory
mysqldump -h127.0.0.1 -uroot -ppass myweb | gzip > d:/backupfile.sql.gz
Backup MySQL A database ( some ) surface . This example backup table1 Table and table2 surface . Backup to linux The host /home Next
mysqldump -h127.0.0.1 -uroot -ppass myweb table1 table2 > /home/backupfile.sql
Backup multiple files at the same time MySQL database
mysqldump -h127.0.0.1 -uroot -ppass --databases myweb myweb2 > multibackupfile.sql
Just back up the database structure . At the same time, the backup name is myweb Database and name myweb2 database
mysqldump --no-data -h127.0.0.1 -uroot -ppass --databases myweb myweb2 > structurebackupfile.sql
Back up all databases on the server
mysqldump --all-databases -h127.0.0.1 -uroot -ppass > allbackupfile.sql
3、 Restore
Restore MySQL Database commands . Restore the current backup named backupfile.sql The database of
mysql -h127.0.0.1 -uroot -ppass myweb < backupfile.sql
Log in to mysql database
then , Carry out by source Command execution recovery
source /backup/backupfile.sql
Restore compressed MySQL database
gunzip < backupfile.sql.gz | mysql -h127.0.0.1 -uroot -ppass myweb
Move the database to the new server .
This example is to the local database myweb Copy to the remote database named serweb in ,
among , The remote database must be named serweb The database of , It should be created in advance
mysqldump -h127.0.0.1 -uroot -ppass myweb | mysql --host=***.***.***.*** -u Database user name -p Database password -C serweb
版权声明
本文为[The hunter is eating meat]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210611118300.html
边栏推荐
- C language array processing batch data
- Scikit learn sklearn 0.18 official document Chinese version
- Qtablewidget usage explanation
- Install the yapiupload plug-in in idea and upload the API interface to the Yapi document
- 【ACM】376. 摆动序列
- Map basemap Library
- Arcpy adds fields and loop assignments to vector data
- Re regular expression
- 多功能工具箱微信小程序源码
- Crawl the product data of Xiaomi Youpin app
猜你喜欢
Solving the problem of displaying too many unique values in ArcGIS partition statistics failed
JD freefuck Jingdong HaoMao control panel background Command Execution Vulnerability
Operators in C language
Batch export ArcGIS attribute table
硬核解析Promise对象(这七个必会的常用API和七个关键问题你都了解吗?)
ArcGIS table to excel exceeds the upper limit, conversion failed
Robocode tutorial 5 - enemy class
C language loop structure program
【ACM】455. 分发饼干(1. 大饼干优先喂给大胃口;2. 遍历两个数组可以只用一个for循环(用下标索引--来遍历另一个数组))
[UDS unified diagnostic service] (Supplement) v. detailed explanation of ECU bootloader development points (2)
随机推荐
I/O多路复用及其相关详解
Stanford machine learning course summary
【ACM】70. 爬楼梯
QT reading and writing XML files (including source code + comments)
Crawl lottery data
Random number generation of C #
硬核解析Promise对象(这七个必会的常用API和七个关键问题你都了解吗?)
Queue solving Joseph problem
journal
Rewrite four functions such as StrCmp in C language
Crawl the product data of Xiaomi Youpin app
Array rotation
Rust: a simple example of TCP server and client
Resolves the interface method that allows annotation requests to be written in postman
The vivado project corresponding to the board is generated by TCL script
re正则表达式
[UDS unified diagnostic service] IV. typical diagnostic service (6) - input / output control unit (0x2F)
Clion installation tutorial
Cygwin64 right click to add menu, and open cygwin64 here
.105Location