Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
how to create auto back up function
Old 03-07-2010, 09:40 AM how to create auto back up function
Novice Talker

Posts: 6
Trades: 0
HI
I want a function or a script that it makes back up from my data base daily

I have tried some scripts but they weren't work .

how can I do so ?

thanks
hno2005 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-07-2010, 10:19 AM Re: how to create auto back up function
lynxus's Avatar
Awesomeo-Maximo

Posts: 1,618
Location: UK
Trades: 1
if you have linux, You can use this with ftpput.

Create a file called backup in /usr/local/scripts/

Insert this:

#!/bin/bash
cd /usr/local/scripts
echo "Dumping DB"
mysqldump -u root -h localhost -pPASSWORD DATABASENAME > MYdb.sql
echo "Dumped"
echo "Putting .sql to IP OF REMOTE FTP HOST"
ncftpput -V -u FTPuname -p FTPpass IPofFtpHOST /directory/on/your/host /usr/local/scripts/MYdb.sql
echo "Done"
echo "Deleting temp .sql"
rm -f /usr/local/scripts/MYdb.sql
echo "Deleted"


Or just to dump a mysql DB use:

mysqldump -u root -h localhost -pPASSWORD DATABASENAME > MYdb.sql

and backup MYdb.sql
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


lynxus is offline
Reply With Quote
View Public Profile Visit lynxus's homepage!
 
Old 03-07-2010, 11:27 AM Re: how to create auto back up function
Novice Talker

Posts: 6
Trades: 0
Quote:
Originally Posted by lynxus View Post
if you have linux, You can use this with ftpput.

Create a file called backup in /usr/local/scripts/

Insert this:

#!/bin/bash
cd /usr/local/scripts
echo "Dumping DB"
mysqldump -u root -h localhost -pPASSWORD DATABASENAME > MYdb.sql
echo "Dumped"
echo "Putting .sql to IP OF REMOTE FTP HOST"
ncftpput -V -u FTPuname -p FTPpass IPofFtpHOST /directory/on/your/host /usr/local/scripts/MYdb.sql
echo "Done"
echo "Deleting temp .sql"
rm -f /usr/local/scripts/MYdb.sql
echo "Deleted"


Or just to dump a mysql DB use:

mysqldump -u root -h localhost -pPASSWORD DATABASENAME > MYdb.sql

and backup MYdb.sql
thanks for your help but I want to upload a file like backup.php to my root and run it every week
how can i do that ?

thanks
hno2005 is offline
Reply With Quote
View Public Profile
 
Old 03-07-2010, 11:37 AM Re: how to create auto back up function
lynxus's Avatar
Awesomeo-Maximo

Posts: 1,618
Location: UK
Trades: 1
it might just be better to install phpmyadmin and do a dump once a week then.
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


lynxus is offline
Reply With Quote
View Public Profile Visit lynxus's homepage!
 
Old 03-10-2010, 06:28 AM Re: how to create auto back up function
Experienced Talker

Posts: 41
Name: Adam B
Trades: 0
Set up a cron job to run the file once a week, you need access to the web server though. If not some hosts will add them at request, or provide another method for you to set them up.

Last edited by adam89; 03-10-2010 at 06:29 AM..
adam89 is offline
Reply With Quote
View Public Profile
 
Old 03-10-2010, 11:54 AM Re: how to create auto back up function
nayes84's Avatar
Extreme Talker

Latest Blog Post:
Difference between ASP And JSP
Posts: 232
Name: John
Location: Tokyo
Trades: 0
Try using an automatic backup script like this one
http://bash.cyberciti.biz/backup/bac...base-server-2/

then run it using cronjob in daily basis or whatever.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

if(I'm("Helpful")) Add_Talkupation("nayes84");
nayes84 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to how to create auto back up function
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23780 seconds with 12 queries