Automatic backup of Mysql database script under Linux

888u

Last update at :2024-07-09,Edit by888u

1. Mysql database backup script Create the script /bakcup/sqlbak.sh with the following content: Change bmvps.com in FName=bmvps.com to your own domain name, change the /backup/ directory in FP=/backup/ to your own #!/bin/sh d=`date "+%Y-%m-%d-%H-%M-%S"` v_user="database username" v_password="password" FName=bmvps.com_$d FP=/backup/ mysqldump -u$v_user -p$v_password database name --default-character-set=gbk | gzip > $FP$FName.sql.gz 2. Automatically back up Mysql database Before joining the automatic run, you can run it to test whether there are any errors: sh /backup/sqlbak.sh crontab scheduled tasks: If there is no problem, then add it to crontab. crontab -e The content is as follows: 30 3 * * 1 sh /backup/sqlbak.sh Backups are automatically performed every Monday at 3:30 am.

Reprinted from: https://www.jiloc.com/41544.html

Recommended site searches: virtual host rental, unlimited content hosting in the United States, permanent free cloud server in mainland China, Google permanent free server, IP address search, what is the server, Hong Kong high-defense server rental, domain name registration number query, Japan Proxy server IP, Korean virtual host,

Automatic backup of Mysql database script under Linux

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码