Back up PostgreSQL and MySQL Databases

Source: Internet
Author: User
If you cannot back up a MySQL or PostgreSQL database every day, you should back up the database once a week. For many enterprises, database information represents the website content and other important data. Therefore, it is very important to maintain data backup. Fortunately, both MySQL and PostgreSQL provide

If you cannot back up a MySQL or PostgreSQL database every day, you should back up the database once a week. For many enterprises, database information represents the website content and other important data. Therefore, it is very important to maintain data backup. Fortunately, both MySQL and PostgreSQL provide

If you cannot back up a MySQL or PostgreSQL database every day, you should back up the database once a week. For many enterprises, database information represents the website content and other important data. Therefore, it is very important to maintain data backup.

Fortunately, both MySQL and PostgreSQL provide tools to convert the database into a flat-text file, so that you can enter the database information to another system or back up the database and keep it.

To back up a MySQL data, you can use the mysqldump tool. For example, to back up a database named data, you can perform the following operations:

$ Mysqldump-u webuser -- password = pass data> data. dump

Generally, mysqldump adopts the standard format. You should rewrite this standard format into a file name (in this example, write data. dump ). The only drawback of this automatic backup method is that the password must be specified on the command line.

To back up a PostgreSQL database, you can use the pg_dump tool. The user accessing the database needs to run this tool. According to the host access rules stipulated by PostgreSQL, you may not need to enter a password for the database to obtain the database information. The procedure is as follows:

$ Pg_dump data> data. dump

This is the same as the mysqldump tool, but the latter does not require user names or passwords, because you are running this tool as a user with the permission to access the database.

In the two database backup methods, the generated output file provides instructions for re-creating the entire database. Therefore, this output file contains the data and table structure, which is the necessary information for creating a database.

You can also use other command lines to obtain the data you want to save through the preceding two types of commands. For these two commands, you can log on to the website and read all the operation information, and customize your database backup operations.

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.