Jump to content

mysqldump is not recognized


peranha

Recommended Posts

<?php
require ("../connect.php");

// open connection
$connection = mysql_connect($server, $user, $pass) or die ("Unable to connect!");

$backupFile = "../" . $db . date("Y-m-d-H-i-s") . '.sql';
$command = "mysqldump --all-$db > $backupFile";
system($command);

// close connection
mysql_close($connection);

header("Location: admin.php");
?>

 

I get "'mysqldump' is not recognized as an internal or external command,

operable program or batch file."

 

in my error log when I try to run this in the web browser.

 

Any body have any ideas?

Link to comment
https://forums.phpfreaks.com/topic/96639-mysqldump-is-not-recognized/
Share on other sites

if this is a unix box and you can run the command at the shell prompt then you have

the path probably in  your .login or .exrc file or something.

if its a windows box you probably don't have the path. try tweaking the mysqldump to have full path.

 

You have not given mysqldump your username and password. Here is the man page entry for it mysqldump.

<?php
//require ("../connect.php");//mysqldump will create its own connection to the database
// open connection
//$connection = mysql_connect($server, $user, $pass) or die ("Unable to connect!");
$backupFile = "../" . $db . date("Y-m-d-H-i-s") . '.sql';
$username="someName";
$password="password";
$command = "mysqldump --all-$db -u $username -p $password > $backupFile";
system($command);

// close connection
//mysql_close($connection);

header("Location: admin.php");
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.