当前位置:网站首页>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
- powerdesigner各种字体设置;preview字体设置;sql字体设置
- Win1远程出现“这可能是由于credssp加密oracle修正”解决办法
- Differences between SSD hard disk SATA interface and m.2 interface (detailed summary)
- Resolve the error Max virtual memory areas VM max_ map_ count [65530] is too low, increase to at least [262144]
- How to install jsonpath package
- Vulnérabilité d'exécution de la commande de fond du panneau de commande JD - freefuck
- Docker 安裝 Redis
- Selenium + webdriver + chrome realize Baidu to search for pictures
- MySQL_ 01_ Simple data retrieval
猜你喜欢
Nat commun | current progress and open challenges of applied deep learning in Bioscience
STM32学习记录0008——GPIO那些事1
【ACM】455. 分发饼干(1. 大饼干优先喂给大胃口;2. 遍历两个数组可以只用一个for循环(用下标索引--来遍历另一个数组))
C language loop structure program
【ACM】509. Fibonacci number (DP Trilogy)
Robocode tutorial 7 - Radar locking
k8s之实现redis一主多从动态扩缩容
Re expression régulière
Implementation of object detection case based on SSD
Scikit learn sklearn 0.18 official document Chinese version
随机推荐
解决报错max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
Qtablewidget usage explanation
Spark performance optimization guide
powerdesigner各种字体设置;preview字体设置;sql字体设置
What are the relationships and differences between threads and processes
Log4j2 cross thread print traceid
Read excel, int digital time to time
Docker 安装 MySQL
Gobang game based on pyGame Library
MATLAB从入门到精通(二)
proxy server
C language to achieve 2048 small game direction merging logic
I / O multiplexing and its related details
Rust: how to match a string?
From source code to executable file
Basic usage of crawler requests
WIN1 remote "this may be due to credssp encryption Oracle correction" solution
Analysez l'objet promise avec le noyau dur (Connaissez - vous les sept API communes obligatoires et les sept questions clés?)
【ACM】376. 摆动序列
Visualization of residential house prices