MySQL database using command-line Backup | MySQL Database backup command
For example:
Database address: 127.0.0.1
Database user name: root
Database Password: Pass
Database name: MyWeb
Back up the database to the D disk and directory Mysqldump-h127.0.0.1-uroot-ppass myweb > D:/backupfile.sql
Back up to current directory The MySQL database is formatted with the Delete table, allowing the backup to overwrite the existing database without having to manually delete the existing database mysqldump--add-drop-table-h127.0.0.1-uroot-ppass myweb > Backupfile.sql
Backup the MySQL database compressed backup directly to the D disk and directory Mysqldump-h127.0.0.1-uroot-ppass MyWeb | gzip > d:/backupfile.sql.gz
Back up some (some) tables from the MySQL database. This example backs up the Table1 table and the Table2 table. Back up to Linux host Mysqldump-h127.0.0.1-uroot-ppass myweb table1 table2 >/home/backupfile.sql
Back up multiple MySQL databases simultaneously mysqldump-h127.0.0.1-uroot-ppass--databases myweb myweb2 > Multibackupfile.sql
Simply back up the database structure. Backup is also named MyWeb database and named 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
The command to restore the MySQL database. Restore the currently backed up database named Backupfile.sql Mysql-h127.0.0.1-uroot-ppass MyWeb < Backupfile.sql
Restore compressed MySQL database Gunzip < backupfile.sql.gz | Mysql-h127.0.0.1-uroot-ppass MyWeb
Transfer the database to the new server. This example copies the local database myweb to the remote database named Serweb, where the remote database must be named Serweb database Mysqldump-h127.0.0.1-uroot-ppass MyWeb | MySQL--host=***.***.***.***-u database user name-p database password-c serweb
MySQL Command Line Backup database