We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 51481
    • 45 Posts
    Okay, so I'm working on this website for a friend and developing locally on my Chromebook running GalliumOS (a Linux flavour). It only has a 16gb hard drive so I ordered a 128gb to upgrade. I'm using Bitnami to manage the MySQL database and Apache server. I'm sure you can see where this is heading...

    I screwed up and didn't follow the "Moving Your Site to a New Server" guide. I zipped the main MODX folder (containing htdocs, conf, core) but didn't do the "Dumping the Database" step. Am I totally screwed? I have Bitnami up and running again and I thought it would be as simple as extracting the old MODX folder into the new installation, but obviously all the database details are different.

    Is there anything I can do so that I don't have to completely start over again?!

    Thanks in advance for any help offered!!!

    This question has been answered by multiple community members. See the first response.

    • discuss.answer
      • 22840
      • 1,572 Posts
      If you can get a copy of the database simply import it into a new database on the new server and then edit the core config file to point to the new one ( few first lines I think ), if you dont have a copy of the database / can't get one then yeh it's not good as everything including templates, chunks and snippets are stored in the database
      • discuss.answer
        • 3749
        • 24,544 Posts
        The file is core/config/config.inc.php. These are the lines to change:

        $database_user = 'your DB username';
        $database_password = 'your DB password';
        $dbase = 'your database name';
        $table_prefix = 'modx_'; // or whatever is the actual table prefix in the DB (don't forget the underscore)
        $database_dsn = 'mysql:host=localhost;dbname=[b]your database name[/b];charset=utf8';
          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
          • 51481
          • 45 Posts
          Thanks guys! Bob, I had tried doing that (just changing the values in config.inc.php) but I was still getting errors (500, I think). I still had my old SSD so I popped it back in and dumped the database.

          I'm just starting with a fresh Bitnami install now and will attempt to import my DB... I'll keep this updated!

          EDIT:

          I just tried the import section of phpMyAdmin and selected my file (bitnami_modx.sql) and got the following error:

          SQL query:
          
          
          CREATE TABLE `modx_access_actiondom` (
            `id` int(10) UNSIGNED NOT NULL,
            `target` varchar(100) NOT NULL DEFAULT '',
            `principal_class` varchar(100) NOT NULL DEFAULT 'modPrincipal',
            `principal` int(10) UNSIGNED NOT NULL DEFAULT '0',
            `authority` int(10) UNSIGNED NOT NULL DEFAULT '9999',
            `policy` int(10) UNSIGNED NOT NULL DEFAULT '0'
          ) ENGINE=MyISAM DEFAULT CHARSET=utf8
          MySQL said: Documentation
          
          #1046 - No database selected
            • 42562
            • 1,145 Posts
            With Bitnami in the equation, issues could round up into Mathematical infinity.
              TinymceWrapper: Complete back/frontend content solution.
              Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
              5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
              • 51481
              • 45 Posts
              Tried a few different things but it definitely doesn't want to import that sql file... Maybe I'll try your method, Bob.

              Here's my "old" config.inc.php file:
              $database_type = 'mysql';
              $database_server = 'localhost;unix_socket=/home/matthew/modx/modx-2.4.4pl-1/mysql/tmp/mysql.sock';
              $database_user = 'bn_modx';
              $database_password = '07a240fa55';
              $database_connection_charset = 'utf8';
              $dbase = 'bitnami_modx';
              $table_prefix = 'modx_';
              $database_dsn = 'mysql:host=localhost;unix_socket=/home/matthew/modx/modx-2.4.4pl-1/mysql/tmp/mysql.sock;dbname=bitnami_modx;charset=utf8';


              And here's the "new" one:
              $database_type = 'mysql';
              $database_server = 'localhost;unix_socket=/home/matthew/modx/modx-2.4.4pl-1/mysql/tmp/mysql.sock';
              $database_user = 'bn_modx';
              $database_password = '3ec584817e';
              $database_connection_charset = 'utf8';
              $dbase = 'bitnami_modx';
              $table_prefix = 'modx_';
              $database_dsn = 'mysql:host=localhost;unix_socket=/home/matthew/modx/modx-2.4.4pl-1/mysql/tmp/mysql.sock;dbname=bitnami_modx;charset=utf8';


              Do I just copy those lines from the "old" to the "new" one and save? Should I do that before or after unpacking my root folder? At some point, I'm assuming I need to run the setup script again?

              Thanks again for your help!
                • 51481
                • 45 Posts
                I made some progress... On a fresh installation, I logged into phpMyAdmin as root and deleted the default "bitnami_modx" database. I then created one called "spool_studio" and imported my .sql file (which I renamed to spool_studio.sql) and that worked fine. I changed the line in config.inc.php to say:
                $dbase = 'spool_studio';

                and have left the rest the same as it matches the old installation.

                I copied over all of the files from the original install EXCEPT the new config.inc.php file. I am now getting a 500 error on the main page so I dropped in the setup folder and navigated to it. Everything goes well until "Upgrade Existing Install". I click next and get a 500 error.

                Any ideas on how I can proceed?
                  • 51481
                  • 45 Posts
                  Woops, my mistake! I changed the $dbase line as above, but I forgot to change the bit at the end of this line:
                  $database_dsn = 'mysql:host=localhost;unix_socket=/home/matthew/modx/modx-2.4.4pl-1/mysql/tmp/mysql.sock;dbname=spool_studio;charset=utf8';

                  All fixed!!! Learning more and more each day smiley
                    • 3749
                    • 24,544 Posts
                    I'm glad you got it sorted. wink

                    Hopefully those database credentials above are not the real ones. If they are, and are for a public site, you'll want to change them for your site.
                      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