Forum Moderators: mack

Message Too Old, No Replies

Simple backup tool

for databases

         

Tiebreaker

9:16 am on Sep 15, 2004 (gmt 0)

10+ Year Member



Hi

Can anyone recommend a really simple tool for backing up a MySQL database? My head is spinning, trying to understand how to do this.

Free would be good, but I'm happy to pay a little if necessary.

coopster

6:01 pm on Sep 15, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Free is easy.

[dev.mysql.com...]

mack

8:42 pm on Sep 15, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



if you have shell access to the server it may be an option to simply make a tar.gz of the mysql directory.

log onto shell and visit the location of mysql usualy /var/lib/mysql/

type tar -cpzf mysqltodaysdate.tar.gz *

this will create a current backup. Then should you need to restore simply type...

tar -xzf mysqldateofarchive.tar.gz

If you do not have shell phpmyadmin might be an option. It enables you do download a backup to your local machine from the web. However phpmyadmin does not allow you to do this for large databases.

Mack.
<fixed up typo>

[edited by: mack at 11:30 am (utc) on Sep. 30, 2004]

wheel

4:32 am on Sep 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If it's not too big of a database, you can just dump the darn thing:
mysqldump -u yourmysqluserid -p database_name -a -B>outputfile.txt

That'll dump your database to the file outputfile.txt. If you ever need a restore all you have to do is:
mysq -u yourmysqluserid -p<outputfile.txt

Nice and easy, and the outputfile.txt is readable and editable. You don't want to do this for a large database though.

dvduval

4:42 am on Sep 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Let's say you have a database that is several hundred MBs. What would be the best way to get it onto another computer on a regular basis (ex. backup then ftp to a PC)

mack

7:31 am on Sep 17, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



You might want to have a look at mysql replication.

This enables you to set one server as master and one (or more than one) as slave. You can then let the master feed new data to the slave servers.

Mack.