What is the cron command to backup a mysql database, daily either by emailing the database to me or backing it up on the webserver ?
What is the cron command to backup a mysql database, daily either by emailing the database to me or backing it up on the webserver ?
Check out mysqldump. Use something like:
mysqldump --opt (DB_NAME) -u (DB_USERNAME) -p(DB_PASSWORD) > /path/to/dbbackup.sql
Notice no space after -p.
OrOriginally Posted by trich
0 0 * * * mysqldump --opt (DB_NAME) -u (DB_USERNAME) -p(DB_PASSWORD) > DB_NAME-$(date +%m%d%Y).sql
Service of my company is "free web server" "shared web server" "dedicated web server" in Japan.
[ADSV.JP]FREE WEB SERVER
Total Media Studio Help Forum
TMS at GoogleMap
It is better to put in the path for the binary, so better would be:Originally Posted by Shinichi Kato
Code:0 0 * * * /usr/bin/mysqldump --opt (DB_NAME) -u (DB_USERNAME) -p(DB_PASSWORD) > DB_NAME-$(date +%m%d%Y).sql
So, yes.Originally Posted by jalal
![]()
Service of my company is "free web server" "shared web server" "dedicated web server" in Japan.
[ADSV.JP]FREE WEB SERVER
Total Media Studio Help Forum
TMS at GoogleMap