您好,登錄后才能下訂單哦!
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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。