Moving wordpress from one domain to another (both hosted at dreamhost)

wordpress

#1

Hi there,

I own two domains hosted at dreamhost. One is ethanvalentino.com (A) and the other one is pheromonekid.com (B). Initially B was hosting my wordpress blog which used a MySQL DB (hostname: mysql.B.com, DBs: pheromonekid_com and pheromonekid_com_1).

I moved my wordpress blog simply by moving the files from B to A without bothering too much about MySQL DB and making B redirecting to A. This works.

However, right now I have been requested to sell the domain B and I am worried that if I’ll do that, MySQL hostname mysql.B.com will be wiped out as well and A will cease to work. I created a new hostname (mysql.A.com) and tried to recreate the DBs there, but when I try to create pheromonekid_com and pheromonekid_com_1 I get a message telling me that these DBs already exist.

This leads me to think that mysql.A.com and mysql.B.com are just interchangeable and if I’ll delete domain B everything will go on working, but I wanted to double check with you guys before doing anything like that. In case I am mistaken, what should I do to guarantee continuity with my site (I already exported the DBs so it shouldn’t be that complicated to recreate them)?[hr]
Mmm, on a second thought, I think that I’ll have to move the DB from mysql.B.com to mysql.A.com. Any idea how to do it?


#2

[quote=“ethanv, post:1, topic:54466”]

This leads me to think that mysql.A.com and mysql.B.com are just interchangeable and if I’ll delete domain B everything will go on working, [/quote]

Yes mysql.A.com & mysql.B.com are interchangable HOWEVER - wordpress looks for mysql.A.com
can’t remember which file it’s in, but it’s one of the set up files in wordpress… and you just need to change that…


#3

OK, I figured that out.

Following is a how to migrate wordpress from one domain to another.

Initially wordpress was loaded on pheromonekid.com (olddomain from now on). Thus I created ethanvalentino.com (newdomain.com from now on). Both olddomain.com and newdomain.com were hosted by dreamhost.

[B]CREATE THE NEW HOSTNAME FOR MYSQL:[/B]
[list]
[] login on https://panel.dreamhost.com
[
] Under Goodies->MySQL Databases click on Add New Hostname
[*] Choose a name for the new host and select your new domain (like mysql.newdomain.com)
[/list]

[B]MOVE WORDPRESS FILE FROM THE OLD DOMAIN TO THE NEW ONE[/B]
[list]
[] ssh to dreamhost server using your username and pwd (or alternatively you can use the WebFTP on your dreamhost panel)
[
] copied all files from ~/olddomain.com/[your_blog_directory] to ~/newdomain.com/[your_blog_directory] (in case you don’t have a blog directory it’s fine as well…)
[] edited the file sitemap.xml and replaced all the occurrences of ‘olddomain.com’ with ‘newdomain.com’ (remember to make a backup copy of the file first)
[
] edited the file ~/newdomain.com/[your_blog_directory]/wp_config.php (remember to make a backup copy of the file first) and replaced the field :

with

[/list]

[B]CHANGE THE DB REFERENCES TO THE OLD DOMAIN[/B]
[list]
[] go back to Goodies->MySql Databases
[
] under Hostname you should see mysql.newdomain.com. If you don’t, don’t panic. Usually it takes a bit before propagating the changes. Click on phpMyAdmin near the hostname
[] insert your username and password (they are enlisted in the MySql Databases page if you don’t know/remember them)
[
] once logged in phpMyAdmin click on the name of your DB (it’s on the left)
[] click on SQL on the tab on the right
[
] Write the following commands in the text area:

UPDATE wp_s1uogr_options SET `option_value` = REPLACE(`option_value`, 'olddomain.com', 'newdomain.com') WHERE `option_value` LIKE CONCAT( "%", 'olddomain.com', "%" );
UPDATE wp_s1uogr_posts SET `guid` = REPLACE(`guid`, 'olddomain.com', 'newdomain.com');
UPDATE wp_s1uogr_posts SET `post_content` = REPLACE(`post_content`, 'olddomain.com', 'newdomain.com');
UPDATE wp_s1uogr_postmeta SET `meta_value` = REPLACE(`meta_value`, 'olddomain.com', 'newdomain.com'o);

[*] press ‘Go’
[/list]
That should be it.

[B]NOTES:[/B] I experienced some weirdness with phpMyAdmin and Chrome. Because of a bug with session management, it is pretty impossible to log out phpMyAdmin, so I had to do all this stuff with Firefox or Safari. Also, for extra security you might want to export the DB and create a copy with a different name and user. In that case you should replace the field DB and USERNAME in wp_config.php