Some tips for MySQL Database Backup

Source: Internet
Author: User

Database Backup is the key to protecting the normal operation of the database. The following articles mainly describe some tips for MySQL database backup, we all know that the permissions required by users who use MySQL dump to back up the database are relatively small. Only the select and lock table permissions are required.

Therefore, users who can create a backup database can back up the database to avoid accidental damage to the database.

MySQLdump is a good tool for backing up MySQL databases. It is faster than using backup tools such as phpmyadmin and avoids restrictions such as php. ini. In windows, you can also use scheduled tasks to implement timed remote database backup.

Before backing up the database, we have to make full preparations. First, we created the database user -- backup, and the password is 123456. Next, determine which database we want to back up and where to store it. Then, determine where the backup files of the database are to be stored.

Assume that our task is to back up a database named backup_test on the 192.168.1.2 server and put the backup file in the D: \ bak \ folder. Assuming that the operating system is windows xp, we can use the following methods to perform the backup operation:

You can use the command prompt that comes with windows to call a command prompt. The most common method is to click the Start menu, select "run", and enter the command of cmd to start the command ), enter the following command in the command prompt:

 
 
  1. MySQLdump -ubackup -p123456 -h 192.168.1.2 backup_test > D:\bak\bakcup.sql 

In this command:

MySQLdump is the program name of myqldump;

-U is the database user name, followed by the user name backup;

-P is the password of the database, followed by the password. Note that there must be no space between-p and the password;

-H indicates the address of the database. If this parameter is not set, it indicates that the local database is backed up;

Name of the backup_test database to be backed up;

> It indicates that the MySQLDatabase is uploaded to the end of the file, which is followed by the address of the current file. The suffix of the file can also be .txt.

Once this command is executed, MySQLdump immediately performs the backup operation. Remote backup of the database seems to be a network situation. Generally, remote backup takes some time.

If you write this command to process files in batches, You can regularly back up data through scheduled tasks in windows.

MySQLdump is used in windows to back up the database. Because there is no gzip compression engine, the backup database cannot be compressed. Therefore, if there are too many backup files, you must frequently clean up expired MySQL database backup files.

Related Article

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.