In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to achieve mysql sub-library backup", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "how to achieve mysql sub-library backup" bar!
In fact, sub-library backup is to execute a backup statement (mysqldump) to back up a library. If there are multiple libraries in the database, perform multiple backup statements for backing up a single library. Note that each library can use the corresponding backup library as the library name, ending with. Sql.
I wrote the following script for sub-library backup:
[root@Mysql01 mysqldumpbak] # cat / usr/local/script/mysqldump.sh
#! / bin/bash
Cd / opt/db_backup/db_backup/mysql_bak/
Rq= `date +% F`
Mkdir $rq
Cd $rq
Echo 'start backup time:' `date` > > backup.log
# since this script backup uses gizp compressed backup, it can be decompressed with gzip xxx.sql.gz when pressurized
Mysql-udbbackup_user-proomxxxxx'-e "show databases" | grep-Evi "database | perfor | infor" | sed-r's / ^ ([a Rizz]. * $) / mysqldump-udbbackup_user-proomxxxx'-routines-triggers-events-single-transaction-master-data=2-log-error=backup.err-B\ 1 | gzip >\ 1.sql.gzqpash g' | bash
Echo 'end backup time:' `date` > > backup.log
Test:
[root@Mysql01 mysqldumpbak] # sh / usr/local/script/mysqldump.sh
After the script is executed, the following sql statement is produced and the following sql is automatically executed for backup
/ home/mysql/mysql/bin/mysqldump-udbbackup_user-pxx-- routines-- triggers-- events-- single-transaction-- master-data=2-- log-error=backup.err-B app | gzip > app.sql.gz
/ home/mysql/mysql/bin/mysqldump-udbbackup_user-pxx-- routines-- triggers-- events-- single-transaction-- master-data=2-- log-error=backup.err-B ad | gzip > auod.sql.gz
/ home/mysql/mysql/bin/mysqldump-udbbackup_user-pxx-- routines-- triggers-- events-- single-transaction-- master-data=2-- log-error=backup.err-B ad_moerben | gzip > auod_moerben.sql.gz
/ home/mysql/mysql/bin/mysqldump-udbbackup_user-pxx-- routines-- triggers-- events-- single-transaction-- master-data=2-- log-error=backup.err-B ccms | gzip > cz_bj_cms.sql.gz
/ home/mysql/mysql/bin/mysqldump-udbbackup_user-pxx-- routines-- triggers-- events-- single-transaction-- master-data=2-- log-error=backup.err-B cs | gzip > cz_bj_oms.sql.gz
Thank you for your reading, the above is the content of "how to achieve mysql sub-library backup". After the study of this article, I believe you have a deeper understanding of how to achieve mysql sub-library backup, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.