設為首頁

收藏本站

導覽首頁 | 新登場    ◇聯盟溫泉 | 民宿 | 人力銀行 | 女性 |

類型:Linux_commend

MySQL 備份using mysqldump & crontab
Backing up MySQL Database using mysqldump & crontab

Open terminal and type:
sudo tcsh

pico /etc/crontab
or
nano /etc/crontab

And add one of the following lines depending on your situation. This schedule the backup on 1am every day.

Remote Host backup with linked PATH to mysqldump:
0 1 * * * mysqldump -h mysql.host.com -uusername -ppassword --opt database > /path/to/directory/filename.sql

Remote Host backup:
0 1 * * * /usr/local/mysql/bin/mysqldump -h mysql.host.com -uusername -ppassword --opt database > /path/to/directory/filename.sql

Local Host mysql backup:
0 1 * * * /usr/local/mysql/bin/mysqldump -uroot -ppassword --opt database > /path/to/directory/filename.sql

(There is no space between the -p and password or -u and username - replace root with a correct database username.)
參考:
https://www.comentum.com/cron-rsync-mysqldump.html

104休閒信箱 2.3.0 © 104mm.com 2001 - 2018. 您尚未登錄
Page generated in 0.00427604 seconds with 3 Queries