I want to back up and roll back the back up on a database, and I’m trying to see what’s wrong:
‘mysqldump’ is not recognized as an internal or external command, operable program or batch file.
The above is what I get in the file that is exported. And this is what I run:
$database = 'logindb';
$backup = $location.'/'.$database.'_backup_'.date('Y').'_'.date('m').'_'.date('d').'.sql';
exec("mysqldump --opt -h localhost -u root logindb > $backup 2>&1", $output);
print_r($output);
As $location being my backup folder. So why do I get that error ?
And as additional info, I’m testing on localhost with XAAMP, the Apache server is running and MySQL is running as wel.
Because
mysqldumpis not in httpd user path.I asume you work in Linux (or UNIX).
To know witch directory contains
mysqldumpyou can executewhereis mysqldump.Then you have two options:
Check for mysqldump directory is in PATH environment variable of httpd user (usualy
www-datauser for apache server). And include it in PATH is it not present.Also you can execute
mysqldumpwith full path:Like this: