move gallery tables to another database

mystavash

Joined: 2004-09-12
Posts: 61
Posted: Sun, 2008-05-11 21:09

Hi, all!

Sometimes Gallery chokes up my system, maybe I'm just bad about maintenance, maybe my gallery is just too large for a shared host (54,000 items!), whatever the case may be, my host will sometimes shut down the database that gallery uses and demand I fix it.

My gallery is embedded in Drupal 5, and they're stored in the same database (I used to have restrictions on how many databases I could create), so shutting down the gallery database means shutting down the entire site.

I want to minimize the damage by limiting it to just Gallery.

So, here's what I was thinking: move the gallery tables to another database, and just change the appropriate configuration options. It seems like a delicate process, though. I took a look through the gallery faq, but I didn't see anything quite appropriate. This is similar: http://codex.gallery2.org/Gallery2:FAQ#How_can_I_move_my_gallery_installation_from_one_server_to_another.3F

But I want to leave the files where they are, just move the tables.

1) turn gallery onto maintenance mode
2) backup everything, files and gallery tables.
3) import gallery tables into new database (it will have a different user and password)
4) here's where I think it gets tricky: modify the config file appropriately?

I'd like to know what the safest way to do this is.

Anisa.


Gallery version (not just "2"): 2.2.3
PHP version (e.g. 5.1.6): 5.2.3
PHPInfo Link (see FAQ):
Webserver (e.g. Apache 1.3.33): Apache something
Database (e.g. MySql 5.0.32): MySQL 5.0.41
Activated toolkits (e.g. NetPbm, GD): GD, I believe.
Operating system (e.g. Linux): Windows Vista
Browser (e.g. Firefox 2.0): Netscape 9

Login or register to post comments
alecmyers

Joined: 2006-08-01
Posts: 1209
Posted: Sun, 2008-05-11 21:42

I don't think there's anything dangerous about what you're suggesting.

When you've imported the tables into your new database edit the config.php file and look for the lines:

$storeConfig['database'] = '*****';
$storeConfig['username'] = '****';
$storeConfig['password'] = '****';
$storeConfig['tablePrefix'] = 'g2_';
$storeConfig['columnPrefix'] = 'g_';

You'll keep the same column prefixes and just need to change the database name, the username and the password - and you should be good to go.

If something doesn't work, you can always change those fields back and continue to connect to the pre-existing database while you headscratch.

Login or register to post comments
mystavash

Joined: 2004-09-12
Posts: 61
Posted: Mon, 2008-05-12 19:19

Thank you for your prompt response!

It seemed right, but it's a relief to get confirmation. I'm very protective of my gallery! :)

Anisa.

Login or register to post comments
kailio

Joined: 2005-03-10
Posts: 13
Posted: Tue, 2008-05-20 15:48

how do you turn on maintenance mode?

Login or register to post comments
mystavash

Joined: 2004-09-12
Posts: 61
Posted: Tue, 2008-05-20 20:19

Please see this: http://codex.gallery2.org/Gallery2:FAQ#How_do_I_prevent_users_from_accessing_my_site_during_maintenance_or_upgrades.3F

I had thought there was a way to do this through the Site Admin, but I guess not.

Anisa.

Login or register to post comments