We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13992
    • 8 Posts
    Ok, I searched around for this issue, and nothing I could find was helpful.

    I’m jumping through my first MODx install, and hit a snag on the step 4 pre-install verification. It’s saying that it can’t connect to the database.

    Pre-install validation
    Setup has carried out a number of checks to see if everything’s ready to start the setup.

    Checking PHP version: OK!
    Checking if Register_Globals is off: OK!
    Checking if sessions are properly configured: OK!
    Checking if /assets/cache and /assets/cache/rss directories exist: OK!
    Checking if /assets/cache and /assets/cache/rss directories are writable: OK!
    Checking if /assets/cache/siteCache.idx.php file is writable: OK!
    Checking if /assets/cache/sitePublishing.idx.php file is writable: OK!
    Checking if /assets/images, /assets/files, /assets/flash and /assets/media directories exists: OK!
    Checking if /assets/images, /assets/files, /assets/flash and /assets/media directories are writable: OK!
    Checking if /assets/export directory exists: OK!
    Checking if /assets/export directory is writable: OK!
    Checking if /manager/includes/config.inc.php exists and is writable: OK!
    Creating connection to the database: Database connection failed!
    Please check the database login details and try again.


    • I’ve checked my folder/file permissions, they’re the correct 755/644 (even tried them at 777). No dice.
    • I’ve tried entering the DB settings into manager/includes/config.inc.php and doing upgrade. Nada.
    • I’ve sixtuple-checked my login credentials, and they have every appearance of being correct (yes, I did account for the userid_ added to the beginning of the login and the DB). This isn’t my first time connecting a DB to a CMS install, so I feel pretty confident on that front. Besides, I shouldn’t have gotten past step 2 with wrong credentials. Phbbt.
    • I’ve given MODx install a shot at making a new DB. Nope.
    • My host (LunarPages) is a shared linux box, PHP 5.2.9, cPanel, and no suPHP.

    Thanks in advance.
      • 33337
      • 3,975 Posts
      No Clue.

      You may consider contacting the host about it.

      One thing comes to mind that, u may check for the mysql server name and port if not localhost and 80 respectively.
        Zaigham R - MODX Professional | Skype | Email | Twitter

        Digging the interwebs for #MODX gems and bringing it to you. modx.link
      • The thing is, in the page before, where he gives the database details and it tests for database and connection charset, it passed. Why would it pass on that page, but not during the actual install process?

        The default MySQL port is 3306; 80 is the HTTP port.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 13992
          • 8 Posts
          My thoughts exactly. So bizarre.
          Anyway, I’ll try to get in touch with support.

          Ok, got in touch with support, they said nothing looked amiss on their end. Bizarre.
          The server’s ports are default (not that I saw anywhere to modify port settings in the install script). And as the dump I pasted shows, it has no problem writing to the config.inc.php file.

          I guess I’ll try it on a different domain I own when I get home. Hopefully it’ll work there.
          • You can specify the port in the servername field:
            localhost:8889
            for example in a default MAMP installation.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 13992
              • 8 Posts
              Well, it worked on the other server. Still totally confused as to why it’d fail on my first one, though.

              Even with an explicit port specification, the error persists. Seriously, if DB connection worked in the second step, then it should work in the pre-flight.

              Any other bright ideas?
              • The only thing I can think of is that the database user doesn’t have create-table permissions.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 13992
                  • 8 Posts
                  User has full permissions. Only server limitation that I know of is to create new dbs from the install.
                    • 21940
                    • 20 Posts
                    While trying to install I am given these 3 option fields

                    Database host:

                    Database login name:

                    Database password:

                    I enter the IP as well as my login & pw but I keep getting "Connection to host: failed!"

                    Any ideas as to why this is happening?
                    • Try the host name instead; I’ve never had success with an IP address if it’s localhost.
                        Studying MODX in the desert - http://sottwell.com
                        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                        Join the Slack Community - http://modx.org