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 prepare points regularly for MYSQL under linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article mainly introduces "how to prepare points regularly for MYSQL under linux". In daily operation, I believe that many people have doubts about how to prepare points regularly for MYSQL under linux. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "how to prepare points regularly under linux". Next, please follow the editor to study!

Write a MYSQL backup according to the request of a friend.

1. Make a shell file

two。 Modify / etc/crontab to customize the task plan

[@ more@]

Shell file:

DB_NAME='tdc_ntt_debug'

USER='root'

PWD='rootroot'

TIME=$ (date +% Y%m%d)

DEL_TIME=$ (date-- date= "7 days ago" +% Y%m%d)

DB_BAK_NAME=tdc_debug$ {TIME} .sql

DB_DEL_NAME=tdc_debug$ {DEL_TIME} .sql

BACKUP_PATH='/home/zhaoqun/DB_BAK/day_bak/'

Echo $BACKUP_PATH$DB_BAK_NAME

If test-f $BACKUP_PATH$DB_DEL_NAME

Then

Echo "Delete history dump file"

Rm-f $BACKUP_PATH$DB_DEL_NAME

Fi

Mysqldump-u $USER-p$PWD $DB_NAME > $BACKUP_PATH$DB_BAK_NAME

/ appended in etc/crontab

01 16 * root / home/zhaoqun/DB_BAK/day_bak/day_bak.sh

Make a MYSQL backup at 16:01 every day and keep a 7-day backup resume.

At this point, the study of "how to prepare points regularly for MYSQL under linux" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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

Wechat

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

12
Report