Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Unable to connect to database server!


Guest

Recommended Posts

Hi all.

 

What am i doing wrong.... Just installed with no probs. it connected to the database server to create the catalog during install. But when i go to the admin/default.php i get the above error. I know the database server is working because phpbb is working with no probs....

 

I am new to all this.... :cry:

Link to comment
Share on other sites

I had the same problem

 

My catalog was working fine but I couldn't get the admin to connect to the database.

 

Here's what I did and its working.

 

Go to your application_top.php file in the includes directory or your admin folder.

 

Find the line (above where you insert your database username/password etc.. info) that says this:

define('DB_SERVER', $HTTP_ENV_VARS['HOSTNAME']);

 

comment it out and make it look like this with two slashes before it:

// define('DB_SERVER', $HTTP_ENV_VARS['HOSTNAME']);

 

 

Then below that add this line:

define('DB_SERVER', 'localhost');

 

For some reason the script isn't finding the server but retuns some off-the-wall junk as the server. I don't know why so I just hard coded 'localhost' as the db server. If that doesn't work for you, change localhost to your domain name. like this:

define('DB_SERVER', 'my-domain.com');

 

Hope that helps you some...

Link to comment
Share on other sites

  • 5 years later...
Go to your application_top.php file in the includes directory or your admin folder.

 

Then below that add this line:

define('DB_SERVER', 'localhost');

 

Because this is like 5 years old + now, but I stumble on it via Google,

note that in at least the 2.2ms versions and later, probably the whole

2.X set - tis is NOT in the application_top file anymore!

 

The instructions are dead-on, just look for configure.php in your /includes

directory for the seting to change. LOCALHOST works fine, we've also had

to use the specific IP Plesk uses for all the DB functions which worked and

you could even try the domain if needed.

 

But, gotta be where they've moved it - the config file!

 

Why were we looking? We moved from a crappy HSP in a Virtuozzo setup

back to (and nevermore returning to virtual) a dedicated box. Everything

moved fine, just that certain quirks weren't handled. Here we had the old

IP address in that file. Copied over perfectly with the Migration Manager

and all that, just didn't update that info! So we followed this advice and

went 'LOCALHOST' so that regardless of the moves made for any reason,

it'd look in what the server considers the default location for itself.

 

So if you've moved recently and OSC's locking up - check the Register

Globals bit first. If you fix that and then you get the 'can't connect to

database' bit - do this! Everything's there, fully working and back to

normal.

 

Just FYI!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...