Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

The dredded 1046 - database not selected error


Old_Navman

Recommended Posts

Hi there, hope somebody can help.

 

Ever since moving to another web host site my data was being displayed incorrectly BUT this is now a secondary problem.

 

So yesterday I was using cPanel. Here is what I did: (in phpMyAdmin)

 

* (operations) copy database to structure + data (we'll call it bm_osc3.sql)

* (operations) re-name existing database to: bm_osc3_temp

* (import) import file bm_osc3.sql

* (operations) rename bm_osc3.sql to bm_osc3_temp.sql

* (operations) rename bm_osc3_temp to bm_osc3

 

No fiddling with anything else including the config.php file. Unfortunately now, when I try to show the products through

normal www address the following error results:

 

1046 - No database selected

 

select configuration_key as cfgKey, configuration_value as cfgValue from configuration

 

[TEP STOP]

 

I've checked under the MySQL Databases and the database in question checks out OK. When I go to phpMyAdmin the database correctly displays

46 records so that shows the structure is intact.

 

I assume the problem could be with config file? I can see that there are several configure.php files. I think the relevant one(s) should be under public_html ??? In my case I run a store and have a directory called store (/public_html/store)

 

So under /home/bm/public_html/store/includes the configure.php file show the following:

 

<?php

/*

$Id: configure.php,v 1.12 2002/06/16 22:11:53 harley_vb Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

 

// Define the webserver and path parameters

// * DIR_FS_* = Filesystem directories (local/physical)

// * DIR_WS_* = Webserver directories (virtual/URL)

define('HTTP_SERVER', 'http://twn.com');

define('HTTPS_SERVER', 'https://twn.com');

define('ENABLE_SSL', false); // secure webserver for checkout procedure?

define('DIR_WS_CATALOG', '/store/');

define('DIR_WS_IMAGES', 'images/');

define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');

define('DIR_WS_INCLUDES', 'includes/'); // If "URL fopen wrappers" are enabled in PHP (which they are in the default configuration), this can be a URL instead of a local pathname

define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');

define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');

define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');

define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');

define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

 

define('DIR_WS_DOWNLOAD_PUBLIC', DIR_WS_CATALOG . 'pub/');

define('DIR_FS_DOCUMENT_ROOT', $DOCUMENT_ROOT); // where your pages are located on the server. if $DOCUMENT_ROOT doesnt suit you, replace with your local path. (eg, /usr/local/apache/htdocs)

define('DIR_FS_CATALOG', DIR_FS_DOCUMENT_ROOT . DIR_WS_CATALOG);

define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');

define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

 

// define our database connection

define('DB_SERVER', 'localhost');

define('DB_SERVER_USERNAME', 'bm_osc3');

define('DB_SERVER_PASSWORD', 'XXXXXXXXX');

define('DB_DATABASE', 'bm_osc3');

define('USE_PCONNECT', 'false'); // use persistent connections?

define('STORE_SESSIONS', 'mysql'); // leave empty '' for default handler or set to 'mysql'

?>

 

Can't see any obvious problems, omissions here.

 

Perhaps the database name has dropped off a querry? But where? Which one?

 

Hope you can help.

 

Thanks in advance

 

PS the twn.com is not a real domain name.

Link to comment
Share on other sites

Hi Ken,

 

I'm not exactly sure as to the Osc ver. (how do I check this) it could be 2.1?

I know it hasn't been updated for a long time but up to now

it's been working Ok though. The PHP ver is 5.2.17 and MySQL version 5.0.91.

 

Cheers Stan

Link to comment
Share on other sites

I've had a look at various configure files to no avail. Can't find the problem. Someone out there must know the answer. I'm not really knowledgable about Osc but there are a lot of you people who seem to know a lot about it. Can anybody HELP?

Link to comment
Share on other sites

It took a while but for the benefit of all yo people I'll tell you how I fixed the problem -

and it's such a straight forward fix. Somebody on this forum should have clicked straight

away what happened (keep in mind though there could be other situations that could

result in same/similar error)

 

When you re-name a database the osc to drops the user(s) from that database.

So in cPanel under the MySQL Databases you should firstly observe that under

Current Databases there is a user missing.

 

If that’s the case just scroll down the page and use Add User to Database

option matching the user to the database resulting in the above error.

Select All Privileges (or whatever might be the case) and press Make

Changes.

 

Voila! problem fixed. :blush:

 

 

 

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...