If he'll put it in a cronjob, you cannot rightly assume what the PWD (present working directory) will be, so that the line:
Code:
sql_bDir="./sql_backups/" #LOCATION FOR SQL BACKUPS TO LAND
Doesn't make sense. You need a full path, or maybe something prefixed with $HOME.
Second, the mysqldump line should be:
Code:
mysqldump -u NAME -p PASS DBASENAME
Finally, you should understand that the output is not automatically compressed. Do that separately, via a pipe
Code:
mysqldump -u NAME -p PASS | gzip -c > $sql_bName.gz
Finally, you might gain some performance by buffering the output through a program called "dd". This allows mysqldump to do its work for a longer time before switching over to do the compression.
Code:
mysqldump -u NAME -p PASS DBASENAME | dd bs=1M | gzip -c > $sql_bName.gz
For my dump, I make sure the dump is done in a "single-transaction" to ensure that the dump represents a recoverable state. (ie, transactions don't take place during the dump). I also send the output to bzip2 for higher compression.
Code:
mysqldump -u NAME -p PASS --single-transaction DBASENAME | dd bs=1M | bzip2 -c >dumpfile