User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 392,083 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,943 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1361 | Replies: 8
Reply
Join Date: Dec 2004
Location: India
Posts: 234
Reputation: cancer10 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
cancer10's Avatar
cancer10 cancer10 is offline Offline
Posting Whiz in Training

Question mysqldump

  #1  
Jul 12th, 2007
Hi

Does anyone know what is the simplest way to backup a database using the mysqldump function in php?


I have googled a lot and the codes i have found are very hard to understand and most of them does not work.



Thanx in advance for your help.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2006
Location: New Jersey
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Rep Power: 5
Solved Threads: 34
Moderator
Staff Writer
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: mysqldump

  #2  
Jul 12th, 2007
If you are allowed to use exec() then that will make it a one line script. Otherwise you can't access mysqldump directly through PHP.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Reply With Quote  
Join Date: Dec 2004
Location: India
Posts: 234
Reputation: cancer10 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
cancer10's Avatar
cancer10 cancer10 is offline Offline
Posting Whiz in Training

Re: mysqldump

  #3  
Jul 12th, 2007
and how about restoring the db?
Reply With Quote  
Join Date: Jul 2007
Location: Sofia, Bulgaria
Posts: 138
Reputation: MitkOK is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 10
MitkOK's Avatar
MitkOK MitkOK is offline Offline
Junior Poster

Re: mysqldump

  #4  
Jul 12th, 2007
Originally Posted by stymiee View Post
If you are allowed to use exec() then that will make it a one line script. Otherwise you can't access mysqldump directly through PHP.

... or system()
Reply With Quote  
Join Date: May 2006
Location: New Jersey
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Rep Power: 5
Solved Threads: 34
Moderator
Staff Writer
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: mysqldump

  #5  
Jul 12th, 2007
Originally Posted by cancer10 View Post
and how about restoring the db?

http://www.devshed.com/c/a/MySQL/Bac...QL-Database/2/

Originally Posted by MitkOK View Post
... or system()

John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Reply With Quote  
Join Date: Jul 2007
Location: Sofia, Bulgaria
Posts: 138
Reputation: MitkOK is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 10
MitkOK's Avatar
MitkOK MitkOK is offline Offline
Junior Poster

Re: mysqldump

  #6  
Jul 12th, 2007
Backup :

  1. $command = "mysqldump -u [username] -p [password] [databasename] > [backupfile.sql]";

Restore :

  1. $command = "mysqldump -u [username] -p [password] [databasename] < [backupfile.sql]";

  1. system($commmand);

- Mitko Kostov
Reply With Quote  
Join Date: Jul 2007
Posts: 37
Reputation: atplerry is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 3
atplerry atplerry is offline Offline
Light Poster

Re: mysqldump

  #7  
Jul 16th, 2007
this is nice one a really learn from it
Reply With Quote  
Join Date: Jul 2006
Location: Remunj
Posts: 166
Reputation: pritaeas is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 17
pritaeas's Avatar
pritaeas pritaeas is offline Offline
Junior Poster

Re: mysqldump

  #8  
Jul 19th, 2007
Mitko,

the restore command should be using mysql, not mysqldump.
"Premature optimization is the root of all evil."
Donald Knuth / Tony Hoare
Reply With Quote  
Join Date: Jul 2007
Location: Sofia, Bulgaria
Posts: 138
Reputation: MitkOK is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 10
MitkOK's Avatar
MitkOK MitkOK is offline Offline
Junior Poster

Re: mysqldump

  #9  
Jul 19th, 2007
Pritaeas, you are rigth. My bad.

- Mitko Kostov
Last edited by MitkOK : Jul 19th, 2007 at 10:51 am.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb PHP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 12:27 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC