We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36582
    • 463 Posts
    I’m a newbie but having great success with Modx.

    I’ve done a test site replicating a site I’ve already done and now I want to replace the site I’ve already done, with my ultra-flexible Modx version.

    I’m stuck on the database issue. My host seems to be telling me that I can’t download my test database and use it for the ’real’ site but I can export the information and then import it to a new database which I must pre-create in the ’real’ hosting space.

    So I have two questions - How do I transfer the database info? How do I connect the moved Modx site to the new database to obtain the same results as I had on the test site?

    Forgive me if I’ve posted in the wrong place but this seemed to be the most apt.
      Web site design in Nottingham UK by Chris Fickling http://www.chrisficklingdesign.co.uk
      • 7923
      • 4,213 Posts
      As your host said, first export the database from your local environment and then create a new database to your host db and import the exported content there. You can do this easily with phpmyadmin for example if your host has that installed. Then just ftp modx files over to the server and edit the database settings in config.inc.php. For more detailed howto, see http://wiki.modxcms.com/index.php/Moving_Site_To_Another_Location


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 33372
        • 1,611 Posts
        First you’ll want to make a backup of your existing database, which you can do using the MODx Manager’s Backup feature or a separate tool like phpMyAdmin (make sure that you check the box to preserve autoincrement values).

        Then you need to import this data into the new database, so for that you need a database administration tool like phpMyAdmin (actually you could do this via PHP, but it’s much easier if you have a tool). Your host has probably already set this up, but if not you can download and install it yourself. I usually just cut and paste from the SQL file (generated by MODx’s backup script) into the Query window of phpMyAdmin. If your export is very long and your connection slow you may want to do this in chunks (you don’t have to do it all at once). You also probably don’t need any of the log data, so you can delete the parts of the file that insert this data (but keep the code that creates those tables).

        At this point you will now have your database in its new location...

        Next you need to upload all of the MODx files, including the Install folder. Find the config.inc.php file from manager/includes in your previous installation and change the database connection settings in it to the appropriate info for your new database and upload it also. Set the proper permissions for install and make sure that your .htaccess file is correct for your server (assuming you’re running Apache/Linux).

        Next run the MODx installer. It should find the config.inc.php file that you uploaded and ask you if you want to run an Upgrade install. Do this and then clean up by deleting the Install directory and resetting the permissions on your config.inc.php file to 644 as usual.

        Oh there’s one thing in the wiki that doze gave you the link to that I forgot to mention: Make sure that you check all of the path settings in your Manager configuration after you finish the install process. You will still have the paths from your old server there, so you’ll need to change those.

        That’s it!
          "Things are not what they appear to be; nor are they otherwise." - Buddha

          "Well, gee, Buddha - that wasn't very helpful..." - ZAP

          Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
          • 36582
          • 463 Posts
          OK I’m beginning to understand. I will have some questions about the database but in the mean time when I’m uploading all the files including the installer - do you mean all the files that I’ve previously downloaded plus a new version of the installer?

          Many Thanks
            Web site design in Nottingham UK by Chris Fickling http://www.chrisficklingdesign.co.uk
            • 7923
            • 4,213 Posts
            Quote from: ZAP at Jan 22, 2007, 10:30 PM

            Next run the MODx installer.
            Why the MODx installer needs to be run? I’m not saying that it shouldn’t be, just asking..


              "He can have a lollipop any time he wants to. That's what it means to be a programmer."
              • 36582
              • 463 Posts
              And the database questions...

              When exporting from PHPmyadmin I have lots of options - how do I know what I’m getting right? And which type of file to export? If I generate text it appears to have a ’header’ area that contains info about the current database - surely this doesn’t want to be imported to the new database?

              I also get lines of log entries that I understand I don’t want? How do I lose these?

              Thanks again!
                Web site design in Nottingham UK by Chris Fickling http://www.chrisficklingdesign.co.uk
                • 33372
                • 1,611 Posts
                Quote from: doze at Jan 22, 2007, 10:59 PM

                Quote from: ZAP at Jan 22, 2007, 10:30 PM

                Next run the MODx installer.
                Why the MODx installer needs to be run? I’m not saying that it shouldn’t be, just asking..
                It doesn’t absolutely have to be. If you’re using the same exact version of MODx then this is a redundant step. But you could take the opportunity to update to the latest version when you make the switch, and it seems as if this helps to verify that all the tables have been created correctly, database connectivity has been established, etc.

                Quote from: chrisandy at Jan 22, 2007, 11:27 PM

                And the database questions...

                When exporting from PHPmyadmin I have lots of options - how do I know what I’m getting right? And which type of file to export? If I generate text it appears to have a ’header’ area that contains info about the current database - surely this doesn’t want to be imported to the new database?

                I also get lines of log entries that I understand I don’t want? How do I lose these?

                Different versions of phpMyAdmin have different Export options, but I choose to export as SQL with the following options:

                Structure - Add AUTO_INCREMENT value and Enclose table and field names with backquotes
                Data - Use hexadecimal for binary fields (Export type INSERT)

                So far I’ve personally never needed to do anything else, but it’s possible that if you are moving between very different versions of mySQL that you may need to use complete inserts or some other specific option (try it this way first and see how it goes).

                As far as not including the log data, you can just delete all of the lines that say INSERT INTO whatever_log_table before you paste into phpMyAdmin (keep the CREATE TABLE blocks though).

                Any line with a # at the beginning is a comment, so none of those will be processed when you submit the query via phpMyAdmin (this includes the database dump info at the beginning).
                  "Things are not what they appear to be; nor are they otherwise." - Buddha

                  "Well, gee, Buddha - that wasn't very helpful..." - ZAP

                  Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
                  • 36582
                  • 463 Posts
                  Thanks for your help here.

                  Got the transfer of site to work - ran into a couple of problems on the way.

                  Database didn’t produce any #commented items so had to delete the top part of it - it then worked.

                  Then I ran into the file path error - realised my previous site was in a sub domain so set up was slightly different.

                  So I think I’ve done it but I now seem to be struggling with adding images in TinyMCE! Could this be some sort of path problem?
                    Web site design in Nottingham UK by Chris Fickling http://www.chrisficklingdesign.co.uk
                    • 7923
                    • 4,213 Posts
                    Have you checked the paths for resource manager etc. in modx configuration like the wiki article says?


                      "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                      • 36582
                      • 463 Posts
                      Sussed it - it came down to the fact that my original site was in a sub folder within the domain. On the live version the path is formatted in a slightly different way.

                      Thanks for all you help.
                        Web site design in Nottingham UK by Chris Fickling http://www.chrisficklingdesign.co.uk