Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Importing/copying a buddypress mirror locally using MAMP


  • victor_moura
    Participant

    @victor_moura

    I’m new to Buddypress and would like first to make changes in my machine to be sure everything looks right and provide a better user experience. I do not like editing “live” my theme, plugins and updates because I always have users online.

    So MAMP seemed a good option to run a local server on my MacBook.

    What I did was to install MAMP and then do a new wordpress install and add the buddypress plugin to this install which started from zero. This is my lab where I test different themes and plugins.

    There are a few problems however:

    1) This local MAMP version is different from what I currently have online. So my changes almost never look the same.

    2) Starting from zero, I was not able to import my Buddypress groups, forums, user data. The maximum I got was the import of a few blog posts (but not the forum, where all the content is)

    I wonder if you can help me.

    Is there a good way to import my current buddypress to my local machine? I’d like to have a carbon copy, a mirror of the current website…

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • I work with local mirrors on MAMP Pro. This is what I do :

    1. Copy the remote files (the whole install) to my local machine (I do this so the file creation dates are the same).
    2. Backup the remote database with phpMyAdmin (be sure to select Add DROP TABLE) as a gzip file.
    3. Edit the local copy of wp-config.php for my local machine’s database connection.
    4. Create a new local database and import the remote backup (I personally always destroy the local db and create a new empty one to import into – then I know it’s clean).
    5. Use this tool to change all absolute URLs from remote to local: http://spectacu.la/search-and-replace-for-wordpress-databases/

    Then I’ll test new plugins locally before deploying. Also I update plugins locally, and then manually copy them to the server, having had a few past failures updating plugins on production servers. Once it’s running, the only files I normally have to backup from remote to local are all in wp-content (avatars etc., which can easily be sync’d).

    Hope that helps.


    Boone Gorges
    Keymaster

    @boonebgorges

    The procedure suggested by @aljuk is probably as good as you’re going to get right now. For now, the WP import/export process does not recognize the majority of BP content, and there is no standalone BP import/export tool yet.


    victor_moura
    Participant

    @victor_moura

    Hey @aljuk – this was superb!

    I am a newbie, but a newbie with endurance :-)

    I confess I was puzzled by your answer, but then asked the support staff of my hosting company to help me with steps one and two you listed.

    But now I am stuck. On step 3, I understand I should use Notepad (Text Editor on MAC OS) to edit the wp-config.php file that I have downloaded doing step 1 (I’m copying the entire public_html folder using FTP).

    Questions:

    a) what are the specific modifications I should do on the wp-config.php file in my hard disk after the copying of the remote files?
    b) how do I create a new local database? With MAMP? Which configurations should be set for this new database (never did that before)
    c) how do I import the gzip backup of the remote database I made with phpMyAdmin?


    victor_moura
    Participant

    @victor_moura

    Hey @boonebgorges – I’d love to suggest a standalone import/export – doing all these database imports and exports is definitely not an easy task for the below-average user like me, who became pampered with WordPress turn-key solutions :)

    If you can share some light on the 3 questions I made on my reply to @aljuk that would be fantastic! Sorry to bother with these simple questions…


    Boone Gorges
    Keymaster

    @boonebgorges

    I would like to see a full fidelity import-export tool, but it’s a lot of work. Look for it in 2011.


    modemlooper
    Moderator

    @modemlooper

    You have to edit the part about the server. On mamp it will be localhost and your user name and password is usually root. This is so WP can connect to your local database.

    // ** MySQL settings – You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define(‘DB_NAME’, ‘buddypress’);

    /** MySQL database username */
    define(‘DB_USER’, ‘root’);

    /** MySQL database password */
    define(‘DB_PASSWORD’, ‘root’);

    /** MySQL hostname */
    define(‘DB_HOST’, ‘localhost’);

    As for creating a database you go to phpmyadmin enter a name of the db in the create database input and hit create.

    Then in the wp-config file you enter the name you entered here define(‘DB_NAME’, ‘ PUT YOUR DB NAME HERE’);

    @victor_moura – glad to help.

    define(‘DB_NAME’, ‘whatevernameigivethedatabase’);
    define(‘DB_USER’, ‘root’);
    define(‘DB_PASSWORD’, ‘root’);
    define(‘DB_HOST’, ‘localhost’);

    root/root is the default username / password combo for MAMP. Obviously you should never have it set like this on a live public server because it’s instantly hackable, but on your local MAMP (assuming you haven’t got it set up to actually serve a Live site for a client to see online) it’s fine.

    (When setting up a brand new site from scratch, you can also change your database table prefix (the setting is found in wp-config.php) for extra security. Google this to learn why it’s a good idea.)

    b) I use MAMP Pro which comes with phpMyAdmin built in. phpMyAdmin can be launched from MAMP Pro’s interface. When I’m setting up a site I create a folder in my browser bookmarks for local, and one for remote. Aside from the site URLs, I bookmark the phpMyAdmin interface for both local and remote, so I can get to either database in a single click. Obviously, with the remote database it will ask you to log in during the loading, since to bookmark it initially, you’ll need to access it from your website’s cpanel (or wherever you launch phpMyAdmin from at your web host) and to do that you’ll need to be logged in to your host.

    So, go into phpMyAdmin, click “localhost” (top left of main content area) to check you’re on the “home” page, and you’ll see an input field (“Create new database”). Name your db, and click Create (that’s all, no need to touch anything). This will create an empty database (a “shell” if you like) ready to be filled. I find it helpful to name the remote and local dbs differently (otherwise it’s too easy to get confused / messed up) .

    3. Then click “Import”, find your backup and load it. At this stage, absolute URLs in your site will be wrong (they’re pointing to the address of your remote web server, not at your local MAMP server). To correct this in one easy find and replace (whilst protecting the structural integrity of your database tables – very important!) use http://spectacu.la/search-and-replace-for-wordpress-databases/ (it’s a very powerful tool, treat with caution).

    Once you’ve got the hang of it, it’s quick. From starting a remote backup to running that db as a local mirror takes me about 30 seconds.

    i. when I’m loading in a remote db, I always delete the local one (to do this go to “localhost” in phpMyAdmin, click the name of your db in the left hand column and when it’s loaded click “Drop” – it means “Delete” – it’s top right, in red), make a new local one, and load the remote db into this fresh “shell” – just to make sure everything is exact. You can delete the local db from within phpMyAdmin. Incidentally, this usually isn’t the case on a remote database (usually, to delete the remote db if you need to, you have to go into cpanel and select “Database Tool” or something similar).

    ii. When saving the remote db, I select these options (you should Google this stuff) :

    Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT
    Add IF NOT EXISTS
    Complete inserts
    Extended inserts

    Select “save as file” and “gzipped”. Don’t mess around with the dump, or unzip it.

    All of this works for me, with my particular setup. I can’t stress enough how important it is to do thorough testing, to be certain that the backups you make actually work.

    There are several standalone tools out there for more comprehensive db management, but phpMyAdmin works great for me at this point, and it’s so convenient having it all in the browser. What makes MAMP Pro so good is being able to set up multiple virtual servers – sometimes I’ll run several local mirrors of the same site so that I can try out different things and easily compare the results.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] Importing/copying a buddypress mirror locally using MAMP’ is closed to new replies.
Skip to toolbar