Am trying to get a auto backup of our mysql database via a cron job that runs daily.
We have:
$database_user = 'VALUE';
$database_pass = 'VALUE';
$database_server = 'localhost';
// Name of the database to backup
$database_target = 'VALUE';
// Get Database dump
$sql_backup_file = $temp_dir . '/sql_backup.sql';
$backup_command = "mysqldump -u" . $database_user . " -p" . $database_pass . " -h " . $database_server . " " . $database_target . " > " . $sql_backup_file;
system($backup_command);
// End Database dump
Problem is we get a message back from the Cron Daemon with:
Usage: mysqldump [OPTIONS] database [tables]
OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR mysqldump [OPTIONS] --all-databases [OPTIONS]
For more options, use mysqldump --help
sh: -h: command not found
So it looks like it has something to do with the -h
~~~
Anyone have any thoughts on how to fix?