欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

mysql完整備份時(shí)過(guò)濾掉某些庫(kù)的方法

 更新時(shí)間:2017年03月23日 09:59:01   投稿:jingxian  
下面小編就為大家?guī)?lái)一篇mysql完整備份時(shí)過(guò)濾掉某些庫(kù)的方法。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧

mysql進(jìn)行完整備份時(shí)使用--all-database參數(shù)

比如:

#mysqldump -u root -h localhost -p --all-database > /root/all.sql

數(shù)據(jù)導(dǎo)入的時(shí)候,可以先登陸mysql數(shù)據(jù)庫(kù)中,使用source /root/all.sql進(jìn)行導(dǎo)入。

問(wèn)題:

想要在mysqldump備份數(shù)據(jù)庫(kù)的時(shí)候,過(guò)濾掉某些庫(kù)。

這種情況mysqldump備份的時(shí)候就不能使用--all-database了,而是使用--database。

如下:備份數(shù)據(jù)庫(kù)的時(shí)候過(guò)濾掉information_schema、mysql 、test和jkhw_db庫(kù)

[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)

操作方法:

[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:

以上這篇mysql完整備份時(shí)過(guò)濾掉某些庫(kù)的方法就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論