Jump to content
Killersites Forums

Backup database


Recommended Posts

I am working on a college administration site.At present I am using it locally(using localhost).

My aim is to provide an option for database backup in case of system failure.

 

For this I have used the command 'mysqldump -u username -ppasswd -databse>backup.sql'.

 

In Linux(ubuntu) one can use the system command to execute the same.

 

While in Windows 7 system i am not able to do the same.I have tried the system,exec commands etc.

The safe mode is disabled in php.ini file.

 

Can anyone help me to overcome this problem in Windows?

Or

Is there any other way to backup my database?

Link to post
Share on other sites

$backupFile = $db_database.date("Y-m-d-H-i-s").'.sql';

$command = "mysqldump -u $db_user -p$db_password $db_database > ".$backupFile."";

if(!system($command))

echo "Error";

 

Actually I am using PHP.The above code fragment is what I have used.

 

The above code works in ubuntu , but not in Windows.

 

I want to know how I can make the system command work in windows..

Link to post
Share on other sites

Actually I am using PHP.The above code fragment is what I have used.

 

Sorry - I realized that a bit later when going through a Google search on the topic. Still, the first link I provided doesn't seem to use the system() function (which I am assuming is Linux only?) so it may be an alternative (or you can look at the source code and pull bits and pieces of whatever you need?)

 

Also, you may want to look at the comments on http://php.net/manual/en/function.system.php -- there are a couple that talk about Windows issues.

Link to post
Share on other sites
  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...