TODO:MONGODB MySQL Database backup
1. MongoDB Using command Backup
Mongodump for the entire database backup, the main use of the command parameters:
-D database to back up
-O Output path
./mongodump–d Databasename–o/data/dbbak
After the backup succeeds, the folder with the database name is created in/data/dbbak, and the files are backed up under the folder.
2. MongoDB uses command restore
Mongorestore database Restore, the main use of the command parameters:
-D database to restore
-directoryperdb the directory where the backup database is located, to the database name folder
-drop Delete the data first, then restore the backup data, you need to use caution
./mongorestore–d Databasename–directoryperdb/data/dbbak/databasename
3. MongoDB backs up the entire dbpath, this is the simplest method. But compared to the cost of hard disk resources, lazy time is to directly backup DBPath
4. mysql using command backup
Mysqldump for the entire database backup, the main use of the command parameters:
-U Database Login user Name
-P Database Login password
Mysqldump-uroot-p MyData > Mydata_201611042316.sql
Used time as a backup file name, convenient to record time; ">" is the meaning of the output backup file.
5. mysql using command restore
MySQL database restore, the main use of the command has
-U Database Login user Name
-P Database Login password
Mysql-uroot-p MyData < Mydata_201611042316.sql
"<" means to import backup data
6. mysql use phpmyadmin export, format Select SQL, can be saved on the server, can also be downloaded to the local
7. mysql use phpmyadmin import, format Select SQL
8. The operation is relatively simple, to more practice, this article is a small part in the daily work commonly used to the method, I hope to help you.
Wxgzh:ludong86
AD
TODO:MONGODB MySQL Database backup