Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

REWARD: Database Connection Issue


racerx

Recommended Posts

:blink: I'm getting the following error when trying to access our database. Our hosting service made some changes to our htaccess files for security reasons last week, our site still worked.

Today our host updated our Control Panel and when we went into MyPHP is alerted us :

"Your configuration file contains settings (root with no password) that correspond to the default MySQL privileged account. Your MySQL server is running with this default, is open to intrusion, and you really should fix this security hole."

 

We went to the control panel and it didn't have any users in the MySQL database. We entered the user name and pass and now OS Commerce no longer works.

 

Warning: Access denied for user: 'root@localhost' (Using password: NO) in /home/webadmin/laptops-battery.com/html/catalog/includes/functions/database.php on line 19

 

I've tried adjustments in the configure.php files to no avail, using straight text for the pass and encoded with the new user name.

 

Original Configure.php file text:

 

define('DB_SERVER', 'localhost');

define('DB_SERVER_USERNAME', 'root');

define('DB_SERVER_PASSWORD', '');

define('DB_DATABASE', 'catalog');

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

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

 

Changed Configure.php file

 

define('DB_SERVER', 'localhost');

define('DB_SERVER_USERNAME', 'user'); \\ Where "user" is the new user set up.

define('DB_SERVER_PASSWORD', '*******'); \\where **** is the encoded pass

define('DB_DATABASE', 'catalog');

define('USE_PCONNECT', 'false');

define('STORE_SESSIONS', 'mysql');

 

Any ideas would be great!

Link to comment
Share on other sites

When you say control panel, I assume you are talking about the control panel the hosting provider has for us. The answer is yes, actually that's the only place that I entered a user name and password. OSC was working fine before this. The host just updated the control panel yesterday with a newer version. When we logged into the control panel it let us know that there were no users or passwords assigned to the databases. We then entered a user name and password. The name did show up when looking at MyPHP panel. It actually shows twice under the User Overview and PHP MyAdmin is coming up with access errors when moving through there as well.

 

My PHP User overview:

 

User Host Password Global Priviliges Grant

Any laptops-battery.com No USAGE No

Any localhost No USAGE No

bigadmin % Yes USAGE No

bigadmin localhost Yes ALL PRIVILEGES Yes

catalog localhost Yes ALL PRIVILEGES Yes

je03ff % Yes USAGE No

je03ff localhost Yes USAGE No

pma localhost No USAGE No

root laptops-battery.com No ALL PRIVILEGES Yes

root localhost Yes ALL PRIVILEGES Yes

 

The error we are getting on our OS Commerce page is:

Warning: Access denied for user: 'root@localhost' (Using password: NO) in /home/webadmin/laptops-battery.com/html/catalog/includes/functions/database.php on line 19

 

Warning: MySQL Connection Failed: Access denied for user: 'root@localhost' (Using password: NO) in /home/webadmin/laptops-battery.com/html/catalog/includes/functions/database.php on line 19

Unable to connect to database server!

 

Any ideas..

Link to comment
Share on other sites

look into your file

/home/webadmin/laptops-battery.com/html/catalog/includes/configure.php

 

if you entered there the correct username and password

 

regards

ralf

sometimes I change code before reading the comments, sometimes code doesn't even have comments, sometimes I rechange code after I read the code others wrote :-)

Link to comment
Share on other sites

define('DB_SERVER_PASSWORD', '*******'); \\where **** is the encoded pass

no, you must enter here the password in plain text.

 

regards

ralf

sometimes I change code before reading the comments, sometimes code doesn't even have comments, sometimes I rechange code after I read the code others wrote :-)

Link to comment
Share on other sites

Thanks for your assistance, much appreciated!

Unfortunately, no luck yet.

 

I've attempted it in plain text and just did it again for fun.

 

define('DB_SERVER', 'localhost'); // eg, localhost - should not be empty for productive servers

define('DB_SERVER_USERNAME', 'bigadmin');

define('DB_SERVER_PASSWORD', '*******'); //plain text this time

define('DB_DATABASE', 'catalog');

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

define('STORE_SESSIONS', 'mysql'); //

 

The error in the browser says:

Warning: Access denied for user: 'root@localhost' (Using password: NO) in /home/webadmin/laptops-battery.com/html/admin/includes/functions/database.php on line 19

 

Warning: MySQL Connection Failed: Access denied for user: 'root@localhost' (Using password: NO) in /home/webadmin/laptops-battery.com/html/admin/includes/functions/database.php on line 19

Unable to connect to database server!

 

Why is it "root@localhost" and not bigadmin?

Why is password set to "no"?

Is this the wrong direction?

Link to comment
Share on other sites

I've been in contact with them and am having difficulty getting help. They have "esculated it, OH Boy!"

 

Isn't the permissions that I posted earlier in the thread the persmissions you are talking about? They were accessed from PHP Myadmin. If not, are you familiar with a simple test program to attempt to connect to the database without all the variables to rule this out?

Link to comment
Share on other sites

Permissions for Catalog database

 

User Host Type Privileges Grant Action

bigadmin % database-specific ALL PRIVILEGES Yes

bigadmin localhost global ALL PRIVILEGES Yes

database-specific ALL PRIVILEGES Yes

catalog localhost global ALL PRIVILEGES Yes

root laptops-battery.com global ALL PRIVILEGES Yes

root localhost global ALL PRIVILEGES Yes

 

 

 

Current configure.php file (this is the file that we started with that was working. The bigadmin user is new in the Catalog database.)

 

 

<?php

/*

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 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://www.laptops-battery.com'); // eg, http://localhost - should not be empty for productive servers

define('HTTPS_SERVER', ''); // eg, https://localhost - should not be empty for productive servers

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

define('DIR_WS_CATALOG', '/catalog/'); // absolute path required

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

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

define('DIR_WS_INCLUDES', 'includes/');

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', '/var/www/html');

define('DIR_FS_CATALOG', '/var/www/html/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'); // eg, localhost - should not be empty for productive servers

define('DB_SERVER_USERNAME', 'root');

define('DB_SERVER_PASSWORD', '');

define('DB_DATABASE', 'catalog');

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

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

?>

Link to comment
Share on other sites

/home/webadmin/laptops-battery.com/html/admin/includes/functions/database.php

 

there are two files called configure.php. The one for the admin section is under admin/includes/configure.php.

 

Edit this file also and set it to the right values.

 

regards

ralf

sometimes I change code before reading the comments, sometimes code doesn't even have comments, sometimes I rechange code after I read the code others wrote :-)

Link to comment
Share on other sites

Current configure.php file  (this is the file that we started with that was working. The bigadmin user is new in the Catalog database.)

 

 

 

 

// define our database connection

  define('DB_SERVER', 'localhost'); // eg, localhost - should not be empty for productive servers

  define('DB_SERVER_USERNAME', 'root');

  define('DB_SERVER_PASSWORD', '');

  define('DB_DATABASE', 'catalog');

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

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

?>

If this is your "current configure.php file" (catalog), then it has USERNAME "root" and no password - this probably worked before the security update, but will return exactly the error you have :blink:

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...