In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "Shell script sharing for regular backup of mysql under CentOS". The content of 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 "Shell script sharing for regular backup of mysql under CentOS".
1. Backup statement
The code is as follows:
# / usr/local/mysql/bin/mysqldump-utest-ptest test--socket=/tmp/mysql.3306.sock > / usr/local/mysql_backup/3306/test- `date +% Y% m% d`.sql.gz
Statement description:
/ usr/local/mysql/bin/mysqldump:MySql installation directory
-utest: divided into two parts, one is-u and the other is test;, where-u represents the user name and test represents the current user name
-ptest: divided into two parts, one is-u and the other is test;, where-u represents the password and test represents the current password
-- socket: which port is backed up, and check which port under / tmp matches
Test: which database to back up
>: which folder is the backup in, and named after the database name-current date
2. Write the statement into a script
3. Edit / etc/crontab
The code is as follows:
# vim / etc/crontab
4. Add below
The code is as follows:
00 3 * root / home/mysql/3306/backup
Note: backup is the script you just wrote
Indicates that a backup is performed at 3 o'clock every day
5. Restart crontab
The code is as follows:
# / etc/rc.d/init.d/crond restart
Thank you for reading, the above is the content of "Shell script sharing for regular mysql backup under CentOS". After the study of this article, I believe you have a deeper understanding of the problem of Shell script sharing for regular mysql backup under CentOS, 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.