Join 3,432 readers in helping fund MetaFilter (Hide)


How do I go from MAMP to champ?
February 12, 2012 9:36 PM   Subscribe

How do I transfer my locally-created Wordpress site (using MAMP) to my live Dreamhost site?

I have been working on a Wordpress site locally using MAMP for a while. Now, I want to transfer this to the live site which is hosted at Dreamhost. I am not a web developer or whatever, so go easy on me.

(It's not a big deal if I botch this, as the site has never been published before. I also just put up an htaccess file on the live remote site so nobody can really access this while I am doing this transfer.)

So, I realize that I can push all the files from the local to the remote site via FTP, but I am pretty sure I also need to transfer all the date on the local SQL database, as that won't go over by just FTP'ing my local Wordpress directory, right?

I installed Wordpress on the live Dreamhost site, and it is up and running. However, it looks like Dreamhost used some odd database naming. Also, all the fields in the table on Dreamhost seem odd. For example, on my local setup I have "wp_posts". However, on Dreamhost, they are called something like "wp_asdlfk_posts". I don't really get what that middle jibberish is for (I just typed that jibberish in case the real jibberish is some password or something).

So, do I need to rename the remote database?

And then, do I need to rename all the fields before I import the local stuff? Or do I just need to delete and then overwrite everything?
posted by This_Will_Be_Good to Computers & Internet (13 answers total) 3 users marked this as a favorite
 
In your wp-config.php file there's a variable called "$table_prefix" which I guess is set by default when you install Wordpress now (or maybe Dreamhost sets it). Check that file on both of your machines (local and Dreamhost) - I'm guessing your local config won't have anything, while the Dreamhost one will have the same string as the 'jibberish.'

As far as moving the content, the easiest thing would be to use Wordpress' Export (in Admin >> Tools >> Export). It'll spit out an XML file, which you can then upload into the Dreamhost's Wordpress Admin's Import page.

Alternatively, if you have a ton of content (i.e., the export gives you a huge file that the server can't handle), you could do a mysqldump from your local machine, FTP that to your server, and do a mysqlimport, via the command line.
posted by estherbester at 10:39 PM on February 12, 2012 [2 favorites]


You can also use the addon XCloner. use it on your MAMP install, drop the file on your Dreamhost site, use it on the local install on Dreamhost to import everything.

You'll have to confirm a lot of things, so just say yes to it. You may have to do some link editing if you manually built things, but a quick review should work out.

(full disclosure: I did this for a site and it worked about 98% of the transfer, leaving a few 'localhost' links that needed to be fixed.)
posted by mephron at 2:02 AM on February 13, 2012


I usually do:

1. a mamp mysqldump
2. open dump file in a text editor, do a Search and replace, changing example.local to example.com
3. Open phpmyadmin on dreamhost and import the dump file.

The prefix makes that not work as easily. I'd delete the auto install Dreamhost did and just set up your database and Wordpress files manually.
posted by backwards guitar at 3:45 AM on February 13, 2012


Don't use the Dreamhost Cpanel install. Do a clean install of Wordpress yourself. These are the steps I follow to move Wordpress sites - not MAMP specific but I think it all still applies.

On old server
1. Back up. Zip up your entire blog directory and put it somewhere, just in case.
2. Export all posts as a double backup.
3. Export the dB to your local computer
4. Copy your entire wp-content directory down to your local computer.

On new server
5. Upload WordPress to new server. Make sure to follow same directory names and structure as the old server. It will make your life much easier. Trust me on this one.
6. Create new database.
6. Delete wp-content directory that comes with WordPress and replace with yours from existing blog.
7. Edit wp-config-sample.php file with new dB details, and rename to wp-config.php
8. Import dB from old server into the new server.
9. Point domain to new server.
10. Wait. I am doing this within the same ISP, just consolidating some accounts. So the change for me is instantaneous as I don’t even need to edit name servers. It may take 20 minutes to 2 days for your domain to point to the new server. In the meantime it should still load the old blog.
posted by COD at 5:37 AM on February 13, 2012


Ok, I did the mysqldump and did the find and replace for the local paths.

I uploaded all the Wordpress directory content from my local machine to the server.

Then, I created a new database with the same name as my local database on the server and imported the modified mysqldump from above.

I then created the wp-config file with the username and password from the new database, and the new MySQL name, and uploaded that to the server.

So, I just gave it a shot and I keep getting errors. The current error is "Parse error: syntax error, unexpected T_STRING" and it is pointing to the line for the MySQL hostname. I am guessing that maybe I am just running into the problem pointed out by COD (in his #10) that I need to wait a bit.

So, I will give it a bit of time unless that sounds wrong to anyone.

In the meantime, if anyone sees this, when I edit the wp-config file, I just pasted in my username and password, and then uploaded that. Does that just sit there in plain text, or does that whole pasting in the Wordpress security keys from here do something? I want this to be fairly secure, and I have strong passwords, but that step seemed odd to me.
posted by This_Will_Be_Good at 11:00 PM on February 13, 2012


That is not a DNS issue, that is a php issue. Are you sure you have the location of the database correct in your config file? Normally 'localhost' works fine, but it is possible that you need the absolute path to mySQL.
posted by COD at 6:21 AM on February 14, 2012


Make sure you're not missing an ; on the line above the mysql hostname line, or on that line itself.

Sometimes quotes can be a problem too - make sure you didn't copy curly quotes, and that you're using the same quotes on each side ( as in single ' vs double " )
posted by backwards guitar at 9:54 AM on February 14, 2012


Well, I feel dumb. Yes, I had forgotten a quotation mark after the password.

So, I changed that, and that allowed things to start up -- the blog was visible. However, something really odd is going on. It seems like a lot of the content is missing. The database upload must have worked, because my categories and text and posts are there. But images, plugins, scripts, etc are missing. It seems like the wp-content directory did not really upload fully. I don't get that as I just uploaded the whole directory from the local copy.

I deleted the live wp-content directory and I'm uploading it again, but I don't really know why that happened.

This is one of those things that, if I do get it up and running again, I don't think I'll really understand what happened so I'll be in this mess if it ever happens again. I definitely don't think I have a good workflow for this local/remote system.
posted by This_Will_Be_Good at 12:42 PM on February 14, 2012


Try going through your wp-config.php file again, using this doc page as a reference. I think everything from the "Wordpress Address (URL)" section on down might be relevant to your latest issue.

You can "view source" on a page that doesn't show images properly, and check the IMG SRC attributes to make sure they're pointing to the right place.

You'll get there! =)
posted by estherbester at 1:03 PM on February 14, 2012


Ya, it could be that things didn't upload fully. Maybe right click on the missing image, or script and see what the path should be - then make sure that file is actually uploaded. If you're really stuck, MefiMail me with your ftp information (or just the site url might be enough) and I could take a look.
posted by backwards guitar at 1:10 PM on February 14, 2012


After a lot of confusion, I realized that the CSS file wasn't updated. There was a CSS file that came with the Wordpress theme (call it "theme.css") that I modified. However, after directly uploading the whole Wordpress directory, the CSS style sheet on the server was somehow the unmodified original CSS file from the theme. How could that be?

I just uploaded the modified version again by itself and that seemed to work. I am very confused.

Maybe there was some cached version? Maybe it is because I am using Dreamweaver as my FTP client, and it is doing odd things that I don't get. Things seem to be working now, but I am definitely confused.
posted by This_Will_Be_Good at 1:36 PM on February 14, 2012


Well, I still have no idea how that CSS file ended up as the unedited version. I transferred the whole directory from local to remote, and the local version had my own edited version of "theme.css", but when the FTP transfer was done, it was the unedited version of "theme.css". It must have been some cached version from somewhere? Maybe Dreamweaver caches something? So confused.

estherbester -- thanks, I have the wp-config.php file working now. However, do I really just paste in my database password and upload that to the server? I put that "salt"/"hash" thing set of lines in there, but it is just sitting there plaintext. Doesn't that get overwritten or something with an encrypted version that hides the password? Am I supposed to change this somewhere?
posted by This_Will_Be_Good at 5:32 PM on February 14, 2012


Yes, the config file is unencrypted, however the permissions on it should be such that you can't read it from the web. Point your browser at the file - it should not load.
posted by COD at 1:25 PM on February 15, 2012


« Older How to get some people to stop...   |  What would you do if your neig... Newer »
This thread is closed to new comments.