Jump to content


Photo

*SOLVED* Database Backups


  • Please log in to reply
10 replies to this topic

#1 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 23 June 2006 - 10:00 AM

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.
Think you're smarty?

(Gone until 20 to November)

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 23 June 2006 - 11:20 AM

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

#3 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 23 June 2006 - 12:20 PM

Yeah, I know how to do that, but I want it to do automatic backups, like every week.

Orio.
Think you're smarty?

(Gone until 20 to November)

#4 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 23 June 2006 - 02:40 PM

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.

#5 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 23 June 2006 - 05:41 PM

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 rows
create tableY(all fields);
insert into tableY(...) //Dump all of the rows

With all of the tables in the DB.


Just like PHPmyAdmin does just without it.

Orio.
Think you're smarty?

(Gone until 20 to November)

#6 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 24 June 2006 - 11:45 AM

Anyone? [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]

Orio.
Think you're smarty?

(Gone until 20 to November)

#7 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 24 June 2006 - 12:29 PM

[a href=\"http://sourceforge.net/projects/automysqlbackup/\" target=\"_blank\"]http://sourceforge.net/projects/automysqlbackup/[/a]
Legend has it that reading the manual never killed anyone.
My site

#8 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 24 June 2006 - 04:24 PM

Thanks Andy, it looks good, but I have no idea what it is.
The file is called:
automysqlbackup.sh.2.5
And when I open it with notepad it doesnt look like php =/

Orio.
Think you're smarty?

(Gone until 20 to November)

#9 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 24 June 2006 - 04:50 PM

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!

#10 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 24 June 2006 - 05:08 PM

I was just about to post I found this script! It's a really good one!
Thanks alot everyone!

Orio.
Think you're smarty?

(Gone until 20 to November)

#11 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 24 June 2006 - 05:16 PM

We got there in the end! I'll mark this as solved!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users