Gallery version (not just "2"): 2.3.1
PHP version (e.g. 5.1.6): 5.2.6
PHPInfo Link (see FAQ):
Webserver (e.g. Apache 1.3.33): 2.2.8-1.fc7
Activated toolkits (e.g. NetPbm, GD):
Operating system (e.g. Linux): Linux
Browser (e.g. Firefox 2.0): FF 3.6.6
ok, I have been using Gallery2 for a few years (love it by the way), and I managed to empty my database while I was on my server control panel after a 15 hour day.
I don't have a database backup but I do still have my g2data folder.
Is there any way to get all of my photos back up there without manually resubmitting them (I really need a break here)?
Any help would be greatly appreciated.
Posts: 1555
G2 does not exist without the DB.
Your options are:
1. Ask your host to restore your db from their central backup
2. If the db is totally gone then do this:
a. Rename your old g2data folder and then reinstall G2 by navigating to your site
b. Configure the new install as before
c. Import the images from your old g2data folder using the add from server feature
d. Delete your old g2 data folder
You should be back up and running in a few hours
--
dakanji.com
Posts: 36
Thank you for responding.
Things are looking up.
I found the entire gallery2 directory I had downloaded as a backup, I also found a backup of the database.
Now, all I have to do is somehow, get the correct version of gallery2 installed on my server and import my database.
Posts: 36
How do I import the old database?
I have the the old g2data up on the server but for the life of me, I can't figure out how import from server
I have on DB that is gallery2 backup and one that is a phpmyadmin backup
I pulling hair here
Posts: 1555
If you have something like ...
"DROP TABLE IF EXISTS some-db-table; CREATE TABLE some-db-table ("before each set of data in the backup sql file, just open phpmyadmin and point the "import" to the most recent of the two backup files.
If the g2data folder along with the other g2 files are intact, then all you need to do is restore the db.
--
dakanji.com
Posts: 36
ok - I'll give that a shot. Right now I'm trying to follow the instructions for restoring a gallery;
* If you have a complete backup (database, g2data folder, gallery2 folder including config.php), then just put those things back in place and make sure the webserver user has write permissions on the g2data folder (chmod -R 777 g2data) and it should work again
So far though, the g2data can't be read by gallery2 so I figure it got corrupted in the ftp upload
Posts: 1555
Those instructions you refer to talk about having database, g2data folder and gallery folder in place. So far, it seems you only have two out of the three elements and until you restore the third, the application will not/cannot work.
--
dakanji.com
Posts: 36
When I try to import the database, I get "#1062 - Duplicate entry '24-3' for key 1" error and it stops and I don't have the option of overwriting those entries.
Posts: 1555
Open the backup database file using your favourite text editor and add "DROP TABLE IF EXISTS some-db-table-name;" (without quotes and don't forget the semi colon at the end) on the line above each occurrence of "CREATE TABLE some-db-table-name ("
Once done, save and try to import again.
--
dakanji.com
Posts: 36
before or after the ( ?
ex:
Like This?
CREATE TABLE IF NOT EXISTS `g2_AccessMap` DROP TABLE IF EXISTS some-db-table-name;(
`g_accessListId` int(11) NOT NULL,
`g_userOrGroupId` int(11) NOT NULL,
`g_permission` int(11) NOT NULL,
PRIMARY KEY (`g_accessListId`,`g_userOrGroupId`),
KEY `g2_AccessMap_83732` (`g_accessListId`),
KEY `g2_AccessMap_48775` (`g_userOrGroupId`),
KEY `g2_AccessMap_18058` (`g_permission`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Or
Like Tiis?
CREATE TABLE IF NOT EXISTS `g2_AccessMap` (DROP TABLE IF EXISTS some-db-table-name;
`g_accessListId` int(11) NOT NULL,
`g_userOrGroupId` int(11) NOT NULL,
`g_permission` int(11) NOT NULL,
PRIMARY KEY (`g_accessListId`,`g_userOrGroupId`),
KEY `g2_AccessMap_83732` (`g_accessListId`),
KEY `g2_AccessMap_48775` (`g_userOrGroupId`),
KEY `g2_AccessMap_18058` (`g_permission`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Posts: 1555
... "on the line above each occurrence"
--
dakanji.com
Posts: 36
ok - wish me luck as I have never been this deep in the bowels of a database before.
Posts: 36
The database imported without error - I'm not real sure what to do now
Posts: 36
ok, well I got most of it back - thank you very much
Posts: 1555
Nice although if you simply deleted the DB and then restored it, you should have had everything back but I suspect you did some other things later such as trying to upload the g2data from another source.
Anyway, "most" is better than "none".
Next time you take a backup from phpmyadmin though, make sure you select the option to add drop table.
--
dakanji.com
Posts: 36
yes, absolutely, most is better than none.
And I did make another backup from phpmyadmin WITH the drop table option checked - lol
It seems a few pictures were uploaded by a user after I backup the site so I didn't get those back with old database and had to get them imported with "import from server" feature - I lost the captions but got the pics.
Overall, it has been a very interesting learning experience for me.
Also, the database backups done from within Gallery2 cannot be imported into the SQL server so I really don't know what good they are.
Posts: 1555
You need to manually delete all g2 tables from your db before using the g2 backup. It is designed to go into a blank db.
--
dakanji.com
Posts: 4342
Totally not true. They can be and are used, for backups, and for server-to-server migration as many of us have done.
Posts: 16503
I think he's talking about the, as far as I can tell, totally useless XML backup from the Site Admin > Maintenance page.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 4342
Oh well, he's right about that, then.
Posts: 1555
I see. I have never even clicked on that in all these years of using G2 and always do my backups from phpmyadmin.
I wonder what class etc the code is in ... perhaps it could be changed to a mysqldump type implementation.
Thinking of seeing whether Mindless, the Guardian Angel Dev of the G2 holdouts, will be interested in a roll up of a few bits and bobs into a last hurrah release.
--
dakanji.com
Posts: 36
I totally didn't know that, I should have tried it - I may yet give it a try now that I have a current db backup from the server.