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


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.

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/’);

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.


2013-03-23 22:26:57 Reply

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


2013-08-30 10:55:36 Reply

Thanks man worked for me 😉

Leave a Comment