Author Topic: "Could not select database" ?? Please help!  (Read 31801 times)

0 Members and 1 Guest are viewing this topic.

Offline unviedamour

  • Newbie
  • *
  • Posts: 10
    • View Profile
"Could not select database" ?? Please help!
« on: January 31, 2006, 10:35:35 PM »
Up until a week or two ago, I had a gallery up on my website, belbin-agosto.net, with something like 1500 pictures. My site began recieving a lot of traffic, so my web host moved me to a worse server until the traffic subsided. When this happened, my MySQL database was lost.
They recently moved me back to the better server, but the database is still gone. However, all of my files are intact, 4images is still installed, all the images are still on the server, etc.

I would like to get it up and running again without losing any of the files or information - many of the photos are saved on my old hard drive which I no longer use (and am not quite sure where it is).

So I created a new database today with the same name as before, and made myself a user of the database with the same username and password as before. However, when I try to go to the gallery (belbin-agosto.net/4images) I get this error:

DB Error: Could not select database (belbin2_4images).

What can I do to fix this? As I said above, I would like to get the gallery back up and running without much hassle. I have gotten several emails from visitors to my site inquiring about the gallery, and I want to get it back up for them as soon as possible!

Any help you could give would be greatly appreciated. Thanks!

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: "Could not select database" ?? Please help!
« Reply #1 on: January 31, 2006, 10:44:58 PM »
First, welcome to the forum.

Second, this issue has been covered in the FAQ. Please visit that section before posting. ;)

Offline unviedamour

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: "Could not select database" ?? Please help!
« Reply #2 on: January 31, 2006, 10:56:39 PM »
Thanks. :)

And, sorry for my ignorance, but where? I looked in the FAQ section earlier and I found the question about the config.php file, and I went through it and did what it says...am I missing something?

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: "Could not select database" ?? Please help!
« Reply #3 on: January 31, 2006, 10:59:29 PM »
In that case, you might want to use the forum's search engine.

Here's a related topic for instance :

http://www.4homepages.de/forum/index.php?topic=9276.msg43803#msg43803

Offline unviedamour

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: "Could not select database" ?? Please help!
« Reply #4 on: January 31, 2006, 11:33:40 PM »
I think I found the problem - there are no tables in my database. Is there any way I can get them without having to reinstall the whole thing?

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: "Could not select database" ?? Please help!
« Reply #5 on: February 01, 2006, 12:22:39 AM »
Quote

Is there any way I can get them without having to reinstall the whole thing?


Absolutely. In your data/database/mysql folder, there's a file named : mysql_default.sql and you can apply the whole SQL file into your phpmyadmin by simply importing the file itself. ;)

Note: The file's content creates a prefix with : 4images_. When you'll create your config.php (if it isn't already created), make sure this is the prefix that's been set. Otherwise, more errors will come along. ;)

Offline unviedamour

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: "Could not select database" ?? Please help!
« Reply #6 on: February 01, 2006, 01:54:11 AM »
I've imported the file, but I'm still getting the error message. Here's a screenshot of my phpMyAdmin page:



Are those all the files I need? Here's the end of my config file:

Quote
$db_servertype = "mysql";
$db_host = "localhost";
$db_name = "belbin2_4images";
$db_user = "belbin2_*****";
$db_password = "******";

$table_prefix = "4images_";

define("4IMAGES_ACTIVE", 1);

?>

Except, of course, my username and password are there instead of the asteriks. ;)

I'm really at a loss here. Thanks for all your help so far. :)

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: "Could not select database" ?? Please help!
« Reply #7 on: February 01, 2006, 01:59:44 AM »
Well, if your config.php file is stable like :

Quote

$db_servertype = "mysql";
$db_host = "localhost";
$db_name = "belbin2_4images";
$db_user = "belbin2_*****";
$db_password = "******";

$table_prefix = "4images_";

define("4IMAGES_ACTIVE", 1);


(Disgarding your privacy of username and password. ;)), then everything should be fine - even after your screenshot of phpmyadmin. Simply make sure to delete the PHP installation file of 4images from your server before running 4images and you should be able to load it successfully (store front and ACP). ;)

Offline unviedamour

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: "Could not select database" ?? Please help!
« Reply #8 on: February 01, 2006, 02:09:04 AM »
So my config file is fine and I have all the right files?

What's my next step? Delete the file (what's the name of the file, btw?) ?

And I'm sorry for so many stupid questions, but
Quote
delete the PHP installation file of 4images from your server before running 4images
when you say "running 4images", I'm not quite sure what you mean. :oops: What do I have to load to make it work?

Again, sorry for so many questions!

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: "Could not select database" ?? Please help!
« Reply #9 on: February 01, 2006, 02:13:36 AM »
Since you seem to have fully installed 4images, delete install.php file from your FTP / CPanel. Then, go on your web browser and execute your gallery like this :

http://www.yourgallerydomain.com/yourgalleryname/index.php

From there, you should be able to see your storefront.

Then, if you wish to go to your Admin Control Panel page, execute the login page like this :

http://www.yourgallerydomain.com/yourgalleryname/admin/index.php

(Hope this will be added to the FAQ - this is unbelievable !!!)

Offline unviedamour

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: "Could not select database" ?? Please help!
« Reply #10 on: February 01, 2006, 02:27:35 AM »
Would you believe it's still not working? I can't even find the install file, I must have deleted it when I installed it originally.

I didn't reinstall it when I made the new database - is that the problem? but if I reinstall it, will I lose all of my files and pictures?

I'm so frustrated right now! The tech support guy made it sound so easy - "The images will still be present, however. You will likely need to re-create the database for the image gallery."

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: "Could not select database" ?? Please help!
« Reply #11 on: February 01, 2006, 02:58:25 AM »
Simply try a fresh new installation over a test folder to see if you see the same results. If so, then it is clairly you did something wrong along the process.

Offline unviedamour

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: "Could not select database" ?? Please help!
« Reply #12 on: February 01, 2006, 03:06:44 AM »
Thanks, I'll try that and let you know the results. :) And if the new installation works out, then we try to see what went wrong with the original?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: "Could not select database" ?? Please help!
« Reply #13 on: February 01, 2006, 03:12:20 AM »
Is there any way I can get them without having to reinstall the whole thing?
If you dont have any backups for your database then the answer is - NO.
Even if your image files are intact, the information about them is gone (based on your original post), so it means you will need basicaly start over.

I know it will be very paintfull but I'd suggest you follow these steps:
1) since it seems you already created the database and all needed tables, you dont need instal.php anymore, now go to ACP (Admin Control Panel) -> Settings and check that everything is the way you want to be.

2) Since information about your categories is gone, you will need recreate all categories manualy. But, there is a little trick - you have all your images already placed in data/media/XX/ folders (where XX is a number - category id) So, even though you recreate all categories from ACP, it does not mean that the images will be placed in the correct categories, because category IDs might not be the same as they were on your "old" site...so, you will need move the images into proper XX folders...well, ofcourse if its easier you could simply rename the folders the images in to the correct name as the new category id...like do it one category at a time: create category, find out it's id, find the files that are belong to that category and rename the folder they are in...

3) once you recreated all categories and move all files into correct folders, you will need run "check new images" in ACP and add all images into the database...

Paintfull, but perhaps this will help you to do database backups periodicaly ;)

Good luck.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline unviedamour

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: "Could not select database" ?? Please help!
« Reply #14 on: February 01, 2006, 04:09:09 AM »
I was afraid of that.

Ugh, I can't belive they did this to me! This is going to take up so much extra time that I don't have. :evil:

Thanks for all your help. :)