Simple mysql utility that dumps data from all databases on a server into a date stamped directory - can either be called either through a web site or automated with a PHP binary and entry into your crontab.
By : ov_m
<?php //Full Source at http://www.ov-m.com/mysqlphpbak/
$MYSQL_SERVER="localhost"; // server name $MYSQL_USER="foo"; // authorized mysql user $MYSQL_PASSWD="bar"; // authorized user password $PATHTOMYSQLDUMP="/www/bin/"; // path to mysqldump utility
$DIRNAME="/path/to/database/backup/dir/"; // where to do the backups $DIRNAME.=date("Ymd"); // add date identifier $DIRNAME.="/"; // add trailing slash
echo "Creating New Back Up Directory\n\n";
echo "Using Directory : $DIRNAME<br>\n";
if (@mkdir ($DIRNAME,0700)) { echo "New Directory Created<br>\n"; } else { echo "Directory already exists!\n"; }
//echo $COMMAND_DO."\n"; // uncomment these lines if you want to see all //flush(); // back-ups made on the server
exec($COMMAND_DO); // execute each backup
}
echo "\n\nDONE!\n";
?>
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.