Jump to content

Archived

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

Iklekid

Mysql Backup

Recommended Posts

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

Share this post


Link to post
Share on other sites

Anyone know how to do this? I could really do with having an automatic backup :D

Share this post


Link to post
Share on other sites

You could use my Backup Utility:

 

http://www.phpfreaks.com/script/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.com/tutorials/28/0.php

 

Good luck.

Share this post


Link to post
Share on other sites
<?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

Share this post


Link to post
Share on other sites

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,

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

×

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.