We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37686
    • 94 Posts
    Hi somebody,

    I would like to make a new modx install on a new domain, but with an existing database.
    Is this possible?

    when i go to www.site.com/setup i can only choose new install, and not an advanced upgrade.

    Please thanx
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      That's right. Go ahead and make a new install, use the same database and database login information, but change the table prefix (the default is modx). That's why MODx was designed to use different table prefixes. So, for example, the existing site will have tables like modx_site_content, while your new installation will have site2_site_content. You can name the table prefix anything you like (as long as it fits mysql naming requirements); just to make life easier I'd recommend making it something that makes it clear those tables belong to the new site. In my case, I might do something like sottwell_site_content.
        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
        • 37686
        • 94 Posts
        Quote from: sottwell at Feb 24, 2013, 08:45 AM
        That's right. Go ahead and make a new install, use the same database and database login information, but change the table prefix (the default is modx). That's why MODx was designed to use different table prefixes. So, for example, the existing site will have tables like modx_site_content, while your new installation will have site2_site_content. You can name the table prefix anything you like (as long as it fits mysql naming requirements); just to make life easier I'd recommend making it something that makes it clear those tables belong to the new site. In my case, I might do something like sottwell_site_content.

        thanx.. so what you are saying is that it wont overwrite the excisting database?
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          That's right. Just specify a different table prefix, and you'll be fine. In fact, it won't let you do a new installation using the same prefix.
            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
            • 37686
            • 94 Posts
            Quote from: sottwell at Feb 24, 2013, 10:07 AM
            That's right. Just specify a different table prefix, and you'll be fine. In fact, it won't let you do a new installation using the same prefix.

            But how should i connect the other database later?
            i mean.. the purpose it to communicatie with the excisting database.. not to create a new database
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Use the same database name, username and password. Just use a different table prefix. You can access the existing one with modx_table_name, such as modx_site_content. Your new one will be accessed with newsite_site content. Each site will have its own default table prefix, but you can easily access the other's tables by using its table prefix.
                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
                • 42562
                • 1,145 Posts
                Hi,

                I couldn't understand the thread well.

                Are you trying to let a newly installed MODx use the information from an existing MODx database or
                just want to hinge your new MODx on an existing database, that is, just want to share the space?

                The former means you are moving your MODx site to that new domain.
                The latter, you are just sharing database space.

                Which do you want?
                  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.
                  • 37686
                  • 94 Posts
                  Quote from: donshakespeare at Feb 24, 2013, 03:22 PM
                  Hi,

                  I couldn't understand the thread well.

                  Are you trying to let a newly installed MODx use the information from an existing MODx database or
                  just want to hinge your new MODx on an existing database, that is, just want to share the space?

                  The former means you are moving your MODx site to that new domain.
                  The latter, you are just sharing database space.

                  Which do you want?

                  yes use the new information from an existing MODx database
                    • 3749
                    • 24,544 Posts
                    I think another way to go would be to export the database in PhpMyAdmin. Then drop the whole MODX DB and do a fresh install at the new domain. Then import the saved .sql file in PhpMyAdmin. If it's a different domain, you'd have to run setup in upgrade mode after the import and you might have to adjust paths used by some extras.

                    That way you wouldn't have two full versions of your site in the DB (though it would be easy enough to delete the old one using Susan's method).
                      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
                      • 42562
                      • 1,145 Posts
                      Just to reiterate:

                      0. In phpMyAdmin, go to old database, export all the tables, i.e. export the database!

                      1. Do fresh install on new domain - this will fill up a new database with tables - test the new MODx site - everything works! (DO NOT DELETE THE SETUP FOLDER) CLEAR Cache and leave the area until step #4
                      During installation, better to use the same table_prefix oldMODXdb_ found in your old existing MODx database oldMODXdb_site_content, oldMODXdb_users etc.

                      2. In phpMyAdmin, go to new database select all the tables, drop them! (as in, kill them)

                      3. While still in phpMyAdmin, looking at the awesome empty new database, click import; import the old database
                      This will fill the database with the tables of the old db.
                      At this time, your new MODx site would have undergone a blood transfusion, it will be very very confused.

                      4. In your new domain, run the MODx setup again - update existing database

                      Everything should be fine...except
                      your Friendly URL (update your .htaccess file)
                      missing assets folder (ftp from old domain to new)
                      missing core components folder (ftp from old domain to new)
                        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.