您好,登录后才能下订单哦!
1.编写定时脚本
1.1 linux系统
vi dbback.sh
#!/bin/sh
home=/usr/local/mysql
now=date +%Y%m%d
cd $home/back
echo "You are in backup dir:" %home%
#echo $home/back/$now
$home/bin/mysqldump -u{username} -p{passwd} dbname > $home/back/$now.sql
echo "Your database backup successfully completed"
1.2 windows 系统
新建文件dbback.bat
set home=D:\mysql
set backDir=H:\db\zentao
set now=%date:~0,4%%date:~5,2%%date:~8,2%
cd %backDir%
echo "You are in backup dir:" $home
echo %backDir%\%now%
%home%\bin\mysqldump.exe -uroot -pqwaszxer -h 10.110.1.251 zentao > %backDir%\%now%.sql
echo "Your database backup successfully completed"
2.定义定时任务
2.1 linux 系统
crontab -e
5 1 * /usr/local/mysql/dbback.sh
2.2 windows系统
打开控制面板——》管理工具——》任务计划程序
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。