We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7473
    • 6 Posts
    I tried to log in to the Modx manager this evening and go this:

    Failed to create the database connection!
    . Please run the MODx install utility

    Then upon trying to just access the site I’m working on, I received this error message:

    « MODx Parse Error »
    MODx encountered the following error while attempting to parse the requested resource:
    « PHP Parse Error »

    PHP error debug
    Error: mysql_connect() [function.mysql-connect]: Access denied for user ’thewilso_dlyons’@’localhost’ (using password: YES)
    Error type/ Nr.: Warning - 2
    File: /home/thewilso/public_html/manager/includes/extenders/dbapi.mysql.class.inc.php
    Line: 89
    Line 89 source: if (!$this->conn = ($persist ? mysql_pconnect($host, $uid, $pwd) : mysql_connect($host, $uid, $pwd, true))) {

    Parser timing
    MySQL: 0.0000 s (0 Requests)
    PHP: 0.0110 s
    Total: 0.0110 s
    « MODx Parse Error »
    MODx encountered the following error while attempting to parse the requested resource:
    « Failed to create the database connection! »

    Parser timing
    MySQL: 0.0000 s (0 Requests)
    PHP: 0.0117 s
    Total: 0.0117 s


    What does this mean? I’m a complete beginner when it comes to this stuff so any help would be very much appreciated. I’m trying not to panic because I could get on to both the site and the manager this afternoon, and I don’t know what happened in between then. I’m the only one who’s accessing the server for right now if that helps.
    I tried looking this up and one person suggested that the database info might not match/got changed to what it says in the config.inc.php. However, I took a look and compared the two and all the information (user name, password, database name, etc) is the same.

      • 3749
      • 24,544 Posts
      It means that MODx couldn’t connect to the database. Possibly the MySQL server was down or overloaded or the DB has become corrupted. It’s unlikely that there’s anything wrong with your MODx site itself, though there could possibly be a problem with the config file (you don’t say what version of MODx -- the location of that file is different for each version):

      Revolution: core/config/config.inc.php
      Evolution: manager/includes/config.inc.php

      Important: Do *not* post the contents of that file here. wink

      The first thing to do is wait a while and try again. If it’s still down, take a look at that file. See if it’s there and contains the correct name of the database, user, and password.

      If it looks OK and you’re up to it, try using PhpMyAdmin in cPanel to take a look at the database. If you’re not up to it, contact your host, describe the problem, and ask if there’s a problem with the database server.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 7473
        • 6 Posts
        Wooo sorry forgot to mention what version of Modx I’m using.

        Evolution 1.0.4

        Ok I’ll see if hopefully I can get onto it in the morning. I did check for the config file and it’s there and as far as I know, has the proper information in it. I’ll post again as soon as I have an update. Thanks for the help BobRay!

          • 7473
          • 6 Posts
          Still can’t seem to access anything, I’m getting the same errors.

          I contacted my host and am waiting on a reply. In the meantime, I managed to get into phpmyadmin and took a look at the database and everything seems to be ok. Here’s something odd though, I don’t know enough about MySQL to know if this is a problem or not, but for that database Modx can’t access, the collation is set to latin1_swedish_ci.
          Again I don’t know anything, but could that be the problem? I know in my config.inc.php the database connection char set is utf8.

          ---UPDATE---

          Ok, what I ended up doing is something BobRay suggested on a forum post with a person facing the same exact problem as mine a while ago. Which was to put the install directory (same exact version as the one on there already) back onto my server, run the modx install, choose to upgrade, and don’t install any snippets, chunks, templates, or the sample site.
          And it worked! I was able to sign into my manager and now I can access the site again when not in the manager too.

          Only problem is I had a link to a wordpress blog (also hosted on the same server, in the same public directory in fact on my host) and now I can’t seem to make a database connection to that much like I couldn’t with Modx. Really odd. So I have to look into how to repair that. Maybe it will be along the same lines as the fix here.

          Thanks again BobRay!!

            • 3749
            • 24,544 Posts
            Quote from: Ding at Feb 28, 2011, 01:08 PM

            Ok, what I ended up doing is something BobRay suggested on a forum post with a person facing the same exact problem as mine a while ago. Which was to put the install directory (same exact version as the one on there already) back onto my server, run the modx install, choose to upgrade, and don’t install any snippets, chunks, templates, or the sample site.
            And it worked! I was able to sign into my manager and now I can access the site again when not in the manager too.

            Only problem is I had a link to a wordpress blog (also hosted on the same server, in the same public directory in fact on my host) and now I can’t seem to make a database connection to that much like I couldn’t with Modx. Really odd. So I have to look into how to repair that. Maybe it will be along the same lines as the fix here.

            I’m glad you got MODx working. That’s odd about the WordPress site. I assume that it’s completely independent of MODx and you’re just providing a link to it. It’s strange that both sites would lose that connection at the same time. I can’t think of what might cause that but maybe someone else can.
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 7473
              • 6 Posts
              Strange indeed. Get this, when I was "updating" Modx, I couldn’t access the database I made previously with the login name I had created for it before, I ended up only being able to continue the process with the username and password I use to get on to the cpanel of the host I’m on.
              So I wondered then if I was having the same issue with Wordpress, I went into its config file and changed the username to that one as well, and I was able to make the database connection again.

              I don’t know how but I guess the username got reset to it’s default/master name? Maybe somehow my database username and/or password got corrupted.

              Either way, now both cms are up and running and I can access everything. I wish I knew what happened exactly, but I am glad it’s all working again.
                • 3749
                • 24,544 Posts
                The only two ways I can imagine that happening are either

                1. You entered your MODx username/password during the install or upgrade of the two programs instead of the DB username/password
                2. Your site was hacked by someone who got the MODx username and password and somehow changed the DB password to match them (this seems unlikely to me).
                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting