I am trying to create a php backup routine for my MySQL databases that I can run as CRON jobs a few times a day.
Here is what I have so far:
The error I get is:
Access denied for user 'database'@'%' (using password: YES)
I have set the directorypath folder permissions to 777 and created the file name in advance.
Can you provide assistance with this method or suggest an alternate script? Thank you very much.
$tableName = 'SampleTable';
$backupFile = $_SERVER['DOCUMENT_ROOT'].'/directorypath/Sampletable.sql';
$query = "SELECT * INTO OUTFILE '$backupFile' FROM $tableName";
$result = mysql_query($query) or die(mysql_error());