Jump to content


Photo

Mysql Backup


  • Please log in to reply
7 replies to this topic

#1 Iklekid

Iklekid
  • Members
  • PipPip
  • Member
  • 16 posts
  • LocationUK

Posted 06 March 2003 - 07:08 PM

Hi I would like to make a back up of my websites myswl databse everyday at midnight! I have been told that I can do this using a crontab! I have crontabs on my server but I dont know what coding/command line on the cron tab to use! There is only one databse I would like to back up! Anyoen know how to do this?

Thanks in advance for any help!

Iklekid :D
Webmaster of Dark Wars
[br]http://www.dwog.net

#2 Iklekid

Iklekid
  • Members
  • PipPip
  • Member
  • 16 posts
  • LocationUK

Posted 08 March 2003 - 11:47 AM

Anyone know how to do this? I could really do with having an automatic backup :D
Webmaster of Dark Wars
[br]http://www.dwog.net

#3 dgwade

dgwade
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 08 March 2003 - 11:22 PM

I was just looking for this today. I found a site on Lycos that is pretty helpful:
http://howto.lycos.c...7 26093,00.html
There are pages here on using crontab to run a backup script every so often.

#4 Iklekid

Iklekid
  • Members
  • PipPip
  • Member
  • 16 posts
  • LocationUK

Posted 09 March 2003 - 10:23 AM

thanks I will go and look :lol:
Webmaster of Dark Wars
[br]http://www.dwog.net

#5 phpfreak

phpfreak
  • Members
  • PipPipPip
  • Advanced Member
  • 527 posts
  • LocationEverywhere!

Posted 09 March 2003 - 12:09 PM

You could use my Backup Utility:

http://www.phpfreaks...ipt/view/11.php

Alternatively, I would create a PHP script to do this.

Something like this:

[php:1:6356097178]<?php

$filename = \"mysqldb\".time().\".sql\";

passthru(\"mysqldump -u (username) -p(password) --opt (database_name) > /my/backup/directory/$filename\");
?>[/php:1:6356097178]

Then using my PHP CRON Tutorial, you can set it up on a CRON TAB.

http://www.phpfreaks...orials/28/0.php

Good luck.
Eric 'phpfreak' Rosebrock
Got LAMP?
http://www.Phpfreaks.com Founder

#6 Iklekid

Iklekid
  • Members
  • PipPip
  • Member
  • 16 posts
  • LocationUK

Posted 09 March 2003 - 06:39 PM

<?php  

$filename = \\\"mysqldb\\\".time().\\\".sql\\\";  

passthru(\\\"mysqldump -u (username) -p(password) --opt (database_name) > /my/backup/directory/$filename\\\");  
?>


Do i replace the /my/backup/directory with my full server path to a folder I would like the backups put into??

And also do i jsut do a wget fucntion in the cron tab command?

Thanks

Iklekid
Webmaster of Dark Wars
[br]http://www.dwog.net

#7 phpfreak

phpfreak
  • Members
  • PipPipPip
  • Advanced Member
  • 527 posts
  • LocationEverywhere!

Posted 09 March 2003 - 09:09 PM

Yes, common sense to me would tell me to replace that path to the directory where I want the backup to be stored.

Also, please read the tutorial for the cron tab. It tells you how to use a CGI version of PHP as well as lynx to access your php script.

Thanks,
Eric 'phpfreak' Rosebrock
Got LAMP?
http://www.Phpfreaks.com Founder

#8 Iklekid

Iklekid
  • Members
  • PipPip
  • Member
  • 16 posts
  • LocationUK

Posted 10 March 2003 - 07:36 PM

Hi I am using the script U have created but it dosent seem to want to work!

I have a cron tab set to wrok at midnight

the cron command is

php /home/dwog/public_html/*****/dbsender.php > dev/nul
I am asking for it to email me the fille, I have chmod the directory but still no luck.

Any ideas?

Thanks
Webmaster of Dark Wars
[br]http://www.dwog.net




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users