Quote:
Originally Posted by smithygotlost
How do i go about making php back the database up ?
|
You don't need PHP. RUn this every night and it'll do a full backup and zip it up. Change the parts in
BOLD and also the parts that say "/path/to/..."
#!/bin/bash
# generate the filename for the main DB
BACKUPFILE=$(date +%m-%d-%Y)-main.sql
echo -n "Main database backup file name is: $BACKUPFILE
"
# dump the database to a file
/path/to/mysqldump
DBNAME -u
DBUSER -p
DBPASSWORD --quick -n> /path/to/backup/file/$BACKUPFILE
# zip the file up
/bin/gzip --best /path/to/backup/file/$BACKUPFILE