MySQL command back up the database

Source: Internet
Author: User

One, MySQL database backup command
MySQL database using command Line Backup
For example:
Database address: 127.0.0.1
Database user name: root
Database Password: Pass
Database name: MyWeb
Back up database to 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 compression backup to the D drive and directory directly
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 the Linux host under/home
Mysqldump-h127.0.0.1-uroot-ppass myweb table1 table2 >/home/backupfile.sql
Back up multiple MySQL databases at the same time
Mysqldump-h127.0.0.1-uroot-ppass--databases myweb myweb2 > Multibackupfile.sql
Simply back up the database structure. Back up both the MyWeb database and the 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 a database that is currently backed up with the name Backupfile.sql
Mysql-h127.0.0.1-uroot-ppass MyWeb < Backupfile.sql
Restore a compacted 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 known as a serweb database
Mysqldump-h127.0.0.1-uroot-ppass MyWeb | MySQL--host=***.***.***.***-u database user name-p database password-c serweb
Second, the use of multi-backup backup software
(1), open the MySQL database backup, fill in the database related parameters.
IP: Default 127.0.0.1; Domain name: localhost
User name: Account name of the login database
Password: password to log in to the database
Port number: Default 3306, or find mysql.ext and open, enter the password and press ENTER, after mysql> enter "show global variables like ' Port ';" Enter

image 15.png (47.17 KB, download number: 2)

Download attachments

2015-4-25 15:13 Upload


(2), fill out the parameters, click "Next", tick the database that needs to be backed up, click "Done", the task is created (the file began to be automatically backed up)

image 14.png (51.29 KB, download number: 2)

Download attachments

2015-4-25 15:13 Upload


(3), click "Set Frequency" under "Operation", set the frequency of task backup; " Edit Parameters "Set the user name, password, port number of the connection number library; Backup content re-selects the database that needs to be backed up.

image 13.png (36.43 KB, download number: 2)

Download attachments

2015-4-25 15:13 Upload


Tip: If you need to create a database backup task again, click "Backup Content" under "Actions", click "Add Database", and then follow the same steps as when creating the first database task.
(If the number of tasks is not enough, please redeem the number of tasks on the official website; only one can be created for the same database)

image 12.png (44.15 KB, download number: 2)

Download attachments

2015-4-25 15:13 Upload


3.3. SQL Server Database backup
(1), open the MSSQL database, fill in the relevant parameters;
Instance name: In general, all instance names will be displayed for you to choose, and click "Edit" to fill them in manually.
User name: Account name of the login database
Password: password to log in to the database

image 11.png (39.11 KB, download number: 2)

Download attachments

2015-4-25 15:13 Upload


(2), the other steps as the backup MySQL database, as above.
Summary: Compared with the above two methods, it is obvious that the use of multi-backup software is more convenient. Save a lot of time and effort without a manual backup, and use multiple backups to monitor backup status in real time and solve problems immediately. The final result of the backup will also notify the user in the form of mail, so we do not have to worry about the success of the backup when recovering, if the heart of the hurriedly use up!

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.