Methods for filtering out certain databases during full mysql backup, mysql backup Filtering

Source: Internet
Author: User
Tags mysql backup

Methods for filtering out certain databases during full mysql backup, mysql backup Filtering

Mysql uses the -- all-database parameter for full backup.

For example:

# Mysqldump-u root-h localhost-p -- all-database>/root/all. SQL

When importing data, you can log on to the mysql database and use source/root/all. SQL to import the data.

Problem:

To filter out some databases when mysqldump backs up the database.

In this case, -- all-database cannot be used for mysqldump backup, but -- database is used.

When backing up a database:Filter out the information_schema, mysql, test, and jkhw_db databases.

[Root @ fangfull-backup ~] # Mysql-uroot-p-e "show databases"
Enter password:

+ -------------------- +
| Database |
+ -------------------- +
| Information_schema |
| Hqsb_db |
| Jkhw_db |
| Mysql |
| Test |
| Tech_db |
| Hqtime_o2o_db |
| Hq_o2o_db |
| Hqtime_o2o_db_new |
+ -------------------- +
9 rows in set (0.00 sec)

Operation Method:

[Root @ fangfull-backup ~] # Mysql-uroot-p-e "show databases" | grep-Ev "Database | information_schema | mysql | test | jkhw_db"
Enter password:
Hqsb_db
Tech_db
Hqtime_o2o_db
Hq_o2o_db
Hqtime_o2o_db_new
[Root @ fangfull-backup ~] # Mysql-uroot-p-e "show databases" | grep-Ev "Database | information_schema | mysql | test | jkhw_db" | xargs
Enter password:
Hqsb_db tech_db hqtime_o2o_db hq_o2o_db hqtime_o2o_db_new
[Root @ fangfull-backup ~] # Mysql-uroot-p-e "show databases" | grep-Ev "Database | information_schema | mysql | test | jkhw_db" | xargs mysqldump-uroot-p -- databases> mysql_dump. SQL
Enter password:

The method for filtering out some databases in the above mysql full backup is all the content shared by xiaobian. I hope you can give us a reference, and hope you can provide more support for the customer's house.

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.