In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article will introduce the perfect collaboration between Shell scripts and scheduled tasks with the goal of achieving regular automatic backups of MySQL databases. The Shell script is responsible for the specific backup operation, and the Crond server is responsible for controlling the backup cycle.
[confirm backup scheme]
Backup host: the IP address is 192.168.4.110, and the target host is connected through the network in the cabinet.
Database server: the IP address is 192.168.4.11 and the listening port of the MySQL service is 3306.
Backup content: a remote backup of the studydb,coursdb library in the MySQL server is performed at 2:30 every morning, each library backs up a separate .sql file, then compressed into .tar.gz format, and the date and time when the backup is performed is embedded in the file name.
(1) create a dedicated database backup account Operator, which allows you to connect to the MySQL database from the backup host 192.168.4.110 and grant read access to the studydb,coursedb library.
Create user: login as root enter:
Mysql > CREATE USER 'Operator'@'192.168.4.110' IDENDIFIED BY' pwd123'
Grant Operator permissions:
Mysql > GRANT ALL ON *. * TO 'Operator'@'%'; / / maximum permissions are given here for testing convenience
(2) then test the database access from the backup host to check whether the authorization is valid, or directly use the mysqldump backup tool for testing.
[write MSQL backup script]
First create a backup directory:
[root@localhost~] # mkdir-p / opt/qnzx_dbbak
Then write the appropriate backup script:
[root@localhost~] # vim / qnzx_dbbak.sh
Add permissions and execute them, and then view the backup results:
[set scheduled tasks]
1. Transfer the script to the backup directory
two。 Create a scheduled task to execute the script at a specified time
3. Make sure the crond service is running
This is the content of creating a MySQL backup script. If you think it's not bad, please give me a compliment ~\ (≧▽≦) / ~
If there is any deficiency found by the god, please let me know and I will correct it in time!
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.