Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use script to make mysql back up data in batches automatically

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to use a script to let mysql automatically back up data in batches". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to use scripts to let mysql back up data in batches automatically".

Get the name

# cat datanames.sh

Passwd=xxxxxx

Mysql-password=$passwd mysql.txt# generates a database folder by date, which contains backup failure log I = `cat mysql.txt` nd= `date +% Y% m% d% H`dt =% Y% m% d% H% M% S`mkdir $ndfor i in $I do / usr/bin/mysqldump-pxxxxxx-- opt $I > $nd/$nm-$dt.sql 2 > $dt/error.txtdone

Set the mysqldump.sh script to join corntab to be executed once a day or once a week! Automatic backup of mysql can be realized.

1 12 *. / root/mysql_backup.sh

Thank you for your reading, the above is the content of "how to use scripts to let mysql automatically back up data in batches". After the study of this article, I believe you have a deeper understanding of how to use scripts to make mysql automatically back up data in batches. Specific use also 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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report