What do I do with this message?

DB_ERROR_NOT_CONNECTED occurs when Zen Cart has trouble connecting to your database.

Possible Causes:

  1. Your /includes/configure.php and /admin/includes/configure.php files specify a prefix for your database tables (DB_PREFIX) which does not match what was used when creating the tables. Not matching the prefix value (or specifying one when it is not needed) is a very common mistake for older installations being upgraded. View your database in phpMyAdmin and see if a prefix is used. The first Zen Cart table should be called (something like) address_book.

    If it is called address_book, then your DB_PREFIX value should be ''.

    define('DB_PREFIX', '');

    If it is called zen_address_book, then your DB_PREFIX value should be 'zen_'.

    define('DB_PREFIX', 'zen_');

    If it is called zcaddress_book, then your DB_PREFIX value should be 'zc'.

    define('DB_PREFIX', 'zc');

  2. Your /includes/configure.php and /admin/includes/configure.php files contain settings for the database (DB_SERVER DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE), which are used to log in to the database.

    The 0 DB_ERROR_NOT_CONNECTED error can occur when those database settings no longer match the actual details for the MySQL server, the MySQL database, or the MySQL username+password, or if the database server is broken for some reason.

    For example, if you recently changed your MySQL username/database/password and didn’t put those same changes into your configure.php files, you’ll need to update those files to match what’s required by your MySQL database server.

  3. Some frequently updated tables (such as sessions or whos_online can become corrupt, and cause this problem. Run a “repair” on the database. Most hosts have a Database Repair option listed beside the database names in the webhosting control panel. Ask your host if you need help finding this.

  4. Talk to your hosting company to determine whether they are doing some sort of maintenance on the database. Tell them that your website cannot connect to your MySQL database, and ask them for some assistance in getting that working again.

Still have questions? Use the Search box in the upper right, or try the full list of FAQs. If you can't find it there, head over to the Zen Cart support forum and ask there in the appropriate subforum. In your post, please include your Zen Cart and PHP versions, and a link to your site.

Is there an error or omission on this page? Please post to General Questions on the support forum. Or, if you'd like to open a pull request, just review the guidelines and get started. You can even PR right here.
Last modified March 18, 2024 by Scott Wilson (3db4324).