By DanInSD
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.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted 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:
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:
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
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.