Web Development Blog
OpenCart Error: Could not load database file mysql!
  • Posted:
  • January 31, 2013
  • Comments:

    2

While recently setting up a local installation of OpenCart with a WAMP setup, I encountered an issue where i received the message “Error: Could not load database file mysql!”. Now i went through the proper steps and checked my config.php file to see if I had declared the correct directory filenames for the constants that are defined there.



style="display:inline-block;width:180px;height:150px"
data-ad-client="ca-pub-5076809828671887"
data-ad-slot="8508152554">

Cut to the chase, I had the constants with a leading forward slash ‘/’ when I should not have had one. The proper definitions for me were:

define(‘DIR_APPLICATION’, ‘catalog/’);
define(‘DIR_SYSTEM’, ‘system/’);
define(‘DIR_DATABASE’, ‘system/database/’);
define(‘DIR_LANGUAGE’, ‘catalog/language/’);
etc. etc…

I had it originally with a leading ‘/’ as follows:
define(‘DIR_APPLICATION’, ‘/catalog/’);
define(‘DIR_SYSTEM’, ‘/system/’);
define(‘DIR_DATABASE’, ‘/system/database/’);
etc.etc…

After a ton of messing around and frustration, and also searching google like a madman, I found the suggestion to remove the leading slash and it worked!

Maybe this will help one of you out one day.

2 Comments
Bones

2013-03-23 22:26:57 Reply

Great job man, saved me alot of time with this.

Mansoor

2013-08-30 10:55:36 Reply

Thanks man worked for me ;)

Leave a Comment