Backing up database

christ8

Joined: 2010-02-19
Posts: 53
Posted: Wed, 2010-03-10 02:58
Quote:
Gallery URL = http://shumtravel.hobby-site.com/gallery2/main.php
Gallery version = 2.3.1 core 1.3.0.1
API = Core 7.54, Module 3.9, Theme 2.6, Embed 1.5
PHP version = 5.2.6-1+lenny6 apache2handler
Webserver = Apache/2.2.9
Database = mysqli 5.0.51a-24+lenny3, lock.system=flock
Toolkits = ArchiveUpload, Exif, Gd, ImageMagick, Thumbnail
Acceleration = none, none
Operating system = Linux shum-i7 2.6.26-2-amd64 #1 SMP Thu Feb 11 00:59:32 UTC 2010 x86_64
Default theme = matrix

Have a newbie question regarding backup.
In maintenance mode, I can do backup of the database, which is stored together with my g2data outside of the server.

Do I have to do another backup of mySQL database?

TIA

 
mdlueck
mdlueck's picture

Joined: 2007-02-23
Posts: 115
Posted: Wed, 2010-03-10 03:06

I have not heard of that method of doing a backup. If it indeed backs up the MySQL database and stores that backup file in the g2data dir, then yes I guess that would be an acceptable backup of the database.

Personally I script/automate such maintenance tasks with Bash scripts and set cron jobs to run tasks automagically. Plus I script into said scripts to check the return/exit codes and if something goes wrong then send my admin email account an email right away.

 
christ8

Joined: 2010-02-19
Posts: 53
Posted: Wed, 2010-03-10 16:05

Vow, this is way over my head. One day, I'll learn how to write script and design web pages. Now,I can only do basic things in debian. Anyway, it seems that in maintenance mode, the backup button does work. It came back and tells me that it has backed up my database (even mentioned the name of my database).

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Thu, 2010-03-11 07:18

That method of backup though the Maintenance page has never worked for a restore for me, "backup" works, sure, the restore, not so much.

For a reliable backup, backup your g2data directory and your database (sql dump).
FAQ: How do I backup G2?

____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
mdlueck
mdlueck's picture

Joined: 2007-02-23
Posts: 115
Posted: Fri, 2010-03-12 02:08
Quote:
the restore, not so much.

Would not that be a bit of a circular dependency... to restore the Gallery DB from within Gallery before the DB has been restored to let you in to Gallery in the first place? ;-)

 
christ8

Joined: 2010-02-19
Posts: 53
Posted: Fri, 2010-03-12 03:14

I think I'll take the advice to backup mySQL for a safe measure. Thanks.

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Fri, 2010-03-12 07:00
Quote:
Would not that be a bit of a circular dependency... to restore the Gallery DB from within Gallery before the DB has been restored to let you in to Gallery in the first place? ;-)

Theoretically, I think it was/is intended to be able to install a fresh, blank G2 install and restore from that XML backup. But in the tests I've done, it's never worked for me, where dumps from the DB have survived and been restored during several server moves and host changes over the years.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
christ8

Joined: 2010-02-19
Posts: 53
Posted: Fri, 2010-03-12 14:19

Thanks. But I did not use the dump (have not found out how to). I installed mySQL Administrator, and in it I chose backup db. It did it in a flash to the directory I wanted. It looks like a script file. The program can restore the db as well. Hope this is ok.

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Fri, 2010-03-12 14:41

A little different terminology, but the same thing. You'll have a much more reliably backup that way.

And if you want something you know works for sure, you should test restoring that backup, preferably to a test site and DB that's totally separate than your live/production site.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
mdlueck
mdlueck's picture

Joined: 2007-02-23
Posts: 115
Posted: Thu, 2010-03-25 20:15
Quote:
But I did not use the dump (have not found out how to).

Do you have shell / ssh access to your server?

Here is a link to docs about the program:
http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html

Here is our syntax to backup DB's:

/usr/bin/mysqldump -h HOSTNAME --default-character-set=utf8 -u USERID --password=PASSWORD --opt --single-transaction DB > DBBACKUPFILE

And to restore:

/usr/bin/mysql -h HOSTNAME --default-character-set=utf8 -u USERID -p DB < DBBACKUPFILE

The backup has the password, so totally automated. The restore does not specify the password... I want to be sure a DB does not get wiped out unless I know I am wiping out a DB! ;-)

I hope this helps!