Orio Posted June 23, 2006 Share Posted June 23, 2006 Hello [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /] How do you program a script that backs up the database, saves it to a (txt or sql) file and send it via email?I have no idea how to that... I know I can have a cron task to do that lets say every week, but I have no idea how write the backup script...And no, I am not asking for a full script (tho that could be good [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /] ), just a link to a tutorial, or a general explanation.Oh, and if this can be down via PHPmyAdmin that will be much better.So if it's possible with PHPmyAdmin, a explanation how to do it or a link to a tutorial will be great.Btw, I have Cpanel if this is helpful.Thanks alot,Orio. Quote Link to comment https://forums.phpfreaks.com/topic/12716-solved-database-backups/ Share on other sites More sharing options...
wildteen88 Posted June 23, 2006 Share Posted June 23, 2006 If you have phpMyAdmin you can do a full database thgrough that. To do so login to phpMyAdmin and click the Export link on the main page of phpMyAdmin.This now brings up the database backup page. Select the database(s) from the list on the left. To select multiple databases in the list Crtl + Click on the databases you want to backup.Now read through all various options on the right hand side, the defualt settings should do just fine. Now scroll to the bottom of the page and tick the save as file option, then chose a name and the compression of the file.Once finished click Go. phpMyAdmin will now backup the databases you selected and will prompt you to download the backup file. Thats how you do a database backup through phpMyAdmin Quote Link to comment https://forums.phpfreaks.com/topic/12716-solved-database-backups/#findComment-48742 Share on other sites More sharing options...
Orio Posted June 23, 2006 Author Share Posted June 23, 2006 Yeah, I know how to do that, but I want it to do automatic backups, like every week.Orio. Quote Link to comment https://forums.phpfreaks.com/topic/12716-solved-database-backups/#findComment-48762 Share on other sites More sharing options...
wildteen88 Posted June 23, 2006 Share Posted June 23, 2006 If you want to do it automatically then it'll require you to setup a cron job which will execute your database backup script. Theres are tutorials [a href=\"http://www.php-mysql-tutorial.com/perform-mysql-backup-php.php\" target=\"_blank\"]here[/a] and [a href=\"http://www.developertutorials.com/tutorials/php/backup-mysql-database-php-050409/page1.html\" target=\"_blank\"]here[/a] on backing up a mysql database with PHP/* Off topic */Your avator is really distracting! I cant stop looking at it. Quote Link to comment https://forums.phpfreaks.com/topic/12716-solved-database-backups/#findComment-48801 Share on other sites More sharing options...
Orio Posted June 23, 2006 Author Share Posted June 23, 2006 Thanks for trying wildteen88, but these scripts backup tables. I want a script that finds all the tables in my DB, and then create a file that what's written in it is:create tableX(all fields);insert into tableX(...) //Dump all of the rowscreate tableY(all fields);insert into tableY(...) //Dump all of the rowsWith all of the tables in the DB.Just like PHPmyAdmin does just without it.Orio. Quote Link to comment https://forums.phpfreaks.com/topic/12716-solved-database-backups/#findComment-48872 Share on other sites More sharing options...
Orio Posted June 24, 2006 Author Share Posted June 24, 2006 Anyone? [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]Orio. Quote Link to comment https://forums.phpfreaks.com/topic/12716-solved-database-backups/#findComment-49037 Share on other sites More sharing options...
AndyB Posted June 24, 2006 Share Posted June 24, 2006 [a href=\"http://sourceforge.net/projects/automysqlbackup/\" target=\"_blank\"]http://sourceforge.net/projects/automysqlbackup/[/a] Quote Link to comment https://forums.phpfreaks.com/topic/12716-solved-database-backups/#findComment-49045 Share on other sites More sharing options...
Orio Posted June 24, 2006 Author Share Posted June 24, 2006 Thanks Andy, it looks good, but I have no idea what it is.The file is called:automysqlbackup.sh.2.5And when I open it with notepad it doesnt look like php =/Orio. Quote Link to comment https://forums.phpfreaks.com/topic/12716-solved-database-backups/#findComment-49110 Share on other sites More sharing options...
wildteen88 Posted June 24, 2006 Share Posted June 24, 2006 By looking at the [a href=\"http://members.lycos.co.uk/wipe_out/automysqlbackup/\" target=\"_blank\"]homepage[/a] of that script it is "cron job" code, if there is such as thing. And it looks like you may need root access to use it. Have a look at the installation part (bottom of page).Umm, it looks like we are failing you! :(Would you believe it! We have a premade one here! [a href=\"http://www.phpfreaks.com/script/view/11.php\" target=\"_blank\"]CLICKY[/a]. It looks like there is very few scripts on this! Or I'm putting in the wrong keywords to search for such a script! Quote Link to comment https://forums.phpfreaks.com/topic/12716-solved-database-backups/#findComment-49118 Share on other sites More sharing options...
Orio Posted June 24, 2006 Author Share Posted June 24, 2006 I was just about to post I found this script! It's a really good one!Thanks alot everyone!Orio. Quote Link to comment https://forums.phpfreaks.com/topic/12716-solved-database-backups/#findComment-49120 Share on other sites More sharing options...
wildteen88 Posted June 24, 2006 Share Posted June 24, 2006 We got there in the end! I'll mark this as solved! Quote Link to comment https://forums.phpfreaks.com/topic/12716-solved-database-backups/#findComment-49125 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.