Today, I needed to move accounts over from one WordPress website to another.
It was on a different web host, different database, and different domain.
How does one go about doing this? Well, it’s easier than you may think.
To make things easier, let’s do some labeling…
Website A is the website with the accounts we want to export to a new website.
Website B is the website where we will import the accounts to.
1) Assuming each website has phpMyAdmin available, login to both.
2) Load the corresponding WordPress databases for each website, and navigate to the wp_users table
3) On Website A, click “export”. The default settings are fine so just hit “Go” to save the table’s data.
4) If Website B already has users, then you’ll need to modify the ID numbers for the INSERT INTO `wp_users` query. Admin is ALWAYS number 1 — and all existing WordPress installations already use this for the first made account, so you’ll want to at least make sure that you don’t import anyone into that spot. So let’s look at an example:
INSERT INTO `wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`)
The above is the line that tells the database where to insert these users. Below, is an example user:
(1, 'admin', '$PiojqweAqweSDIjnowW.', 'admin', 'firstname.lastname@example.org', '', '2013-12-13 13:37:00', '', 0, 'Admin');
See the 1 in the beginning? Change that to an unused ID. You can see which IDs are in-use through viewing the wp_users table via phpMyAdmin on Website B and looking at the ID column. All ID numbers should be in order and should be incremental. Save once all users being imported are using a unique ID.
5) On Website B, click “import”, load the SQL file, and hit “Go”.
Easy right? Yeah. It was!
One thing you’ll have to do now though is login to WordPress for Website B (using an existing admin account) and go to each imported account. You’ll need to set their permission level, as well as any other info that may be missing (such as first and last name).