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.