Home > Database > Mysql Tutorial > body text

linux中的mysql自动备份_MySQL

WBOY
Release: 2016-05-31 08:49:30
Original
956 people have browsed it

建备份文件夹:mkdir mysql_data_bak建脚本文件:touch autobackupmysql.sh  www.bitsCN.com  打开文件vi  autobackupmysql.sh在脚本中加入如下内容:filename=`date +%Y%m%d`/usr/bin/mysqldump -uroot -proot boss >>/home/mysql_data_bak/$filename.sql 检查有没安装crond,如果没有,先安装yum -y install vixie-cronyum -y install crontabs启动服务 :service crond start  www.bitsCN.com  在CentOS系统中加入开机自动启动: chkconfig --level 345 crond oncrontab -e加入内容:00 03 * * * source /root/autobackupmysql.sh   每天凌晨3点运行此文件,对数据库进行备份 service crond restart完成

建备份文件夹:mkdir mysql_data_bak建脚本文件:touch autobackupmysql.sh  www.bitsCN.com  打开文件vi  autobackupmysql.sh在脚本中加入如下内容:filename=`date +%Y%m%d`/usr/bin/mysqldump -uroot -proot boss >>/home/mysql_data_bak/$filename.sql 检查有没安装crond,如果没有,先安装yum -y install vixie-cronyum -y install crontabs启动服务 :service crond start  www.bitsCN.com  在CentOS系统中加入开机自动启动: chkconfig --level 345 crond oncrontab -e加入内容:00 03 * * * source /root/autobackupmysql.sh   每天凌晨3点运行此文件,对数据库进行备份 service crond restart完成
原文链接:http://www.bitsCN.com/database/201301/186017.html

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!