Trouble Upgrading because of hosed DB

mosc

Joined: 2006-06-08
Posts: 5
Posted: Mon, 2009-08-17 06:21

I'm running Galley2 2.2.3 and I have a large number of pictures uploaded by several users.

Unfortunately my database got hosed.

I am trying to upgrade to 2.4 hoping that the upgrader will fix up the database. Unfortunately it give this error:

Error: The configured database user does not have the required database privileges to perform the upgrade.
Failed to create, alter or drop a database test table. Check the returned error message and README.html for missing privileges and clean up the database.

Unfortunately, I've rechecked the username password many times and that account has all permissions.

I'm kinda stuck at this point. Is there a way to fix data base problems. Are all my albums and stuff lost forever?

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Mon, 2009-08-17 07:16

If your database is truly hosed, I doubt an upgrade will magically fix it, bit as long as you have a backup, it doesn't hurt to try.

You'll need to talk to your host about the database user and privileges. Gallery doesn't do anything special, just logs into the database with the provided username and password and tries to do it's work. Which ever user you are using needs to be able to create, alter and drop tables.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
mosc

Joined: 2006-06-08
Posts: 5
Posted: Mon, 2009-08-17 15:02

Thanks for the reply, nivekiam.

Do you know where in the code Gallery tries to open the table. I get no error message that indicates what sql attempt failed. I am my own hoster, so I have all permissions. I've given the mysql account all priv possible.

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Mon, 2009-08-17 18:32

No I don't, I'd have to dig into it. But that error message is pretty clear. Double or triple check that the user, you're using does in fact have full permission for your database. Sorry to keep harping on that, but I can't even count the number of times I've seen people ask "What database login details do I enter? Everything I try says access denied." It's ALWAYS that they are not entering something correctly. From the message you're getting I can see that you're entering in the username, password, database name and host correctly. But maybe you're not entering in the correct database name, or that username doesn't have the right access to that database.

Double check what's in your current config.php file against what you think it should be.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
roguehorse
roguehorse's picture

Joined: 2009-08-16
Posts: 13
Posted: Sat, 2009-08-22 18:38

I just recently had a very similar problem. I started a second website through the same host and everything was working fine. Then one day I went online to check everything out and all my photo data links were gone that led to gallery and instead I got a link that said to upgrade to v2.3 which I was already running. I had an IT friend of mine go through everything and he said he couldn't find any file left that were large enough to contain a few hundred photos. It was like someone had deleted all the photos and left the base program that wouldn't go anywhere.

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Sat, 2009-08-22 20:04

There's a lot of crappy hosts out there. You get what you pay for.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
roguehorse
roguehorse's picture

Joined: 2009-08-16
Posts: 13
Posted: Sat, 2009-08-22 20:48

How much should someone have to pay for hosting? I use Dreamhost and I think they are pretty good and I pay pretty good for their hosting. I've never had any problems since '06 and I think my issue was more about security to my g2data files after reading about security on the support and development pages. I did a simple install and rolled with it. I never considered someone being able to use a go around to jack my files, but I guess it's possible. Now I'm left with having to start over from scratch, reload gallery and rebuild. I'm a little wiser this time around and plan on putting as much security to read and write authority as I can. Not only that, but doing more aggressive backup so that (just in case) I can throw it all back.

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Sat, 2009-08-22 23:12

Ah, well I've seen hosts just delete files. Sounds like your issue may have been someone else on the server.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
roguehorse
roguehorse's picture

Joined: 2009-08-16
Posts: 13
Posted: Sat, 2009-08-22 23:44

So how do I protect myself against such things? I just wrote a lengthy post in the Installation section of what I went through at my server. I'm hoping to get a few responses from people who have gone through a similar situation and found a way to combat it.

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Mon, 2009-08-24 22:23

You'd really need to figure out what happened first. But I'd start here in securing your gallery install:
http://codex.gallery2.org/Gallery2:How_do_I_secure_Gallery2
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
roguehorse
roguehorse's picture

Joined: 2009-08-16
Posts: 13
Posted: Tue, 2009-08-25 00:29

Thanks. I did a complete reinstall and it is going well so far. During the install, I paid attention to the STRONG suggestion on implementing or at least reading the security portions. So you're right, before I start adding too much I'll take all the measures I can to secure the new installation.

I have changed permissions to 744 in both Install and Upgrade. I hope this helps. But tell me, how does this save my info in the g2data file from being scrubbed yet still writeable?

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Mon, 2009-08-31 20:47

If permissions are set to 744, then the owner of the files, you or the web server can read, write and execute them, group and the world can only read.

So long as the web server runs as the user who is the owner of the files, then it can change the files. However, if the web server doesn't run as you, then it's running as something generic, like 'apache', or 'nobody' which means that all files it owns can be modified by it and depending on how your server is setup, someone else on your server could run a process under the web server and change or delete those files.

I'm not sure if that helps or confuses you more, ask for any clarification if you need it.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
roguehorse
roguehorse's picture

Joined: 2009-08-16
Posts: 13
Posted: Thu, 2009-09-03 01:27

Got it. I am the only owner of the files and I no longer allow "anonymous" FTP which I used to have on for the sake of Dreamweaver. Hopefully, with the elimination of anonymous FTP and myself being the only owner of the webserver files, without the correct passwords, no changes will be or can be made without my explicit permission. However, webserver admins can do as they please as witnessed in PC Magazines article of the guy who tried to use a webserver for backup. WinSCP works as a great alternative to the elusive expectation that your webserver keeps copies of your pertinent data in storage.