Question

How to migrate an WordPress 4.8 site here at DO to a new 5.8 WP Site set up with MarketPlace 1-Click WP

Posted January 14, 2022 75 views
UbuntuApacheWordPressGetting Started

I have on older droplet with Ubuntu 14 and WordPress 4.8. I just created a new WordPress droplet with the MarketPlace 1-Click Setup. Its a Ubuntu 20.04 and WordPress 5.8 droplet. During WP configuration script I used the same domain name information as my old site etc.

So now I need to know the best way to move the MySQL database and then the wp-content directory. Also, I am probably missing some steps.

Both droplets are in the SFO facility.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi @DanInSD,

At the moment you’ve created two different WordPress installations, one updated to 5.8 and one to 4.8. This means you’ll need to migrate your WordPress installation 4.8 to the new droplet and update WordPress there.

Another solution I can give you is to update your WordPress and Droplet rather than using a new one. You’ve mentioned you are using Ubuntu 14.04, it’s heavily out of date so you’ll need to update it as well.

I’ll try and provide steps for both, scenarios:

  • Updating your Droplet and WordPress
  • Migrating your WordPress to your new droplet.

Let’s start with the first option - Updating your Droplet and WordPress.

Before starting this option make sure to create a backup/snapshot as this process can be tricky and can result in some broken packages:

https://docs.digitalocean.com/products/images/snapshots/

Now, once you do have a backup or a snapshot, SSH to your droplet and type in:

sudo apt update
sudo  apt upgrade
sudo do-release-upgrade

This will initiate the upgrade process, once it finishes you’ll have Ubuntu 18.04. You’ll need to reboot your Droplet and run the same 3 commands again to upgrade to 20.04.

Once this is finished you’ll just need to enter into your WordPress and upgrade it from the admin area

Next method - Migrating your WordPress to your new droplet.

Now, this one, you’ve already created a droplet with your new WordPress on it. What you can do is, dump your database from your old droplet and migrate it with your wp-content folder to your new droplet.

SSH to your droplet and go to the folder where your WordPress installation is located:

cd /path/to/website

In there grep for your MySQL’s credentials:

grep -i DB_ wp-config.php

Once you have them, you need to dump the database there:

mysqldump -u UserName -p DBName > mywordpressbackup.sql

This will dump the information from your database to a file. Now that you have this file, you can transfer it alongside the wp-content folder to your new droplet. You can use FTP for that or use SSH and rsync or scp, it’s up to you.

In case you want to use FTP, give the following docs a read:

https://docs.digitalocean.com/products/droplets/how-to/transfer-files/

Now, once you’ve transferred the data over, you’ll need to create a mysql database and username or use the one already created by your MarketPlace Droplet replace the wp-content folder with your old one and import the db over:

mysql -u UserHere -p DBHere < mywordpressbackup.sql

Hope this helps

  • KFsys, thanks for the suggestions. I will give those two options a try. -Dan

    • Hi @DanInSD,

      Let me know how it goes! I’m eager to hear what you did in the end.

      • The only trick Id like to add is… if you want to see how the second (new instance of) WP is working, its best to edit you computers /etc/hosts file and put the address in there. that way all the links work.

        I added this line:

        141.202.xxx.xxx dankxxxxxxxxx.com

        Now when you point your browser to the site’s URL, you are hitting the second server instead of the original.
        Also, this has the effect of making all the links work correctly inside the new WP site, i.e. posts, graphics, styles, other media

        Again,, this is just during testing of the 2nd server. we haven’t done any change to DNS records yet.

        -Dan

        • Also i would like to point out that sometimes after uploading the wp-content folder to the new site, not all files and folder are owned by www-data. to make sure all is well with the whole thing, run this

          chown -R www-data:www-data /var/www/html/wp-content/