Objective
We all know that data is a relatively important data, often need to back up, each time manually more trouble. Take a look at this article to see how the CentOS system to set up MySQL daily automatic backup bar.
Steps are as follows
To build a backup folder:
To build a script file:
Open File
Add the following in your script:
Filename= ' Date +%y%m%d '
/usr/bin/mysqldump-uroot-proot boss >>/home/mysql_data_bak/$filename. sql
Check if there are no installed Crond, if not, install first
Yum-y Install Vixie-cron
yum-y Install Crontabs
To start the service:service crond start
In the CentOS system, add the boot auto start:chkconfig --level 345 crond on
Add Content: 00 03 * * * source /root/autobackupmysql.sh
Run this file every 3 o'clock in the morning and back up the database
Well, that's done.
Summarize
The above is the entire content of this article, I hope the content of this article for everyone's study or work can bring some help, if there is doubt you can message exchange, thank you for the cloud Habitat Community support.