Learn how to migrate WordPress to DigitalOcean step-by-step with database. Our WordPress & DigitalOcean team is always here to help you.
How to Migrate WordPress to DigitalOcean (Step-by-Step Guide)
Looking to migrate WordPress to DigitalOcean for better performance and control? You’re not alone. Many WordPress users move from shared hosting to a VPS setup like DigitalOcean for faster speed, reliability, and cost-efficiency. In this guide, you’ll get the exact steps needed to move your site without any fluff. Let’s dive right into the process to migrate WordPress to DigitalOcean efficiently.
An Overview
Step 1: Backup Your Website Files and Database
Before anything, back up your essential WordPress data:
- MySQL database: Download it from PHPMyAdmin on your current hosting.
- wp-content folder: This holds your themes, plugins, and media.
- .htaccess file: If you’ve added any custom rules, back it up as well.
These three components are key to a complete and functional WordPress migration.
Step 2: Spin Up a DigitalOcean Droplet
- Create a new droplet (DigitalOcean API create snapshot) using the one-click WordPress on Ubuntu 14.04.
- SSH into the server with the root credentials provided.
- Update your server with:
sudo apt-get update -y
Once logged in, the welcome screen shows default MySQL and PHP settings (see DigitalOcean no detected components issue if they don’t appear). You can also view them later with:
cat /etc/motd.tail
It’s recommended to change the default MySQL root password using:
mysql_secure_installation
Step 3: Set Up PHPMyAdmin
You’ll need PHPMyAdmin to easily import your old database.
- Install PHPMyAdmin:
sudo apt-get install phpmyadmin
- Enable PHP mcrypt:
sudo php5enmod mcrypt
- Increase file upload limit:
- Edit /etc/php5/apache2/php.ini
- Set file_uploads, upload_max_filesize, and post_max_size to 50MB or more.
- Restart Apache:
sudo service apache2 restart
Step 4: Import Your Database
Create a new database and user:
Using CLI:
mysql -u root -p
CREATE DATABASE devopscube_db;
CREATE USER db_admin@localhost IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON devopscube_db.* TO db_admin@localhost IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
exit
Or, do it through PHPMyAdmin. Then:
- Log in to PHPMyAdmin.
- Select your new database.
- Use the Import tab to upload your .sql file and import it.
Step 5: Upload wp-content Folder
Transfer your wp-content folder using SCP or FileZilla. Replace the existing one at /var/www/html/wp-content.
Set correct permissions:
sudo chown -R www-data:www-data /var/www/html/wp-content
Update your wp-config.php file:
- Set the correct database name, user, and password.
- Make sure the table prefix matches your old setup (e.g., wp_ or custom_).
Step 6: Point Your Domain to DigitalOcean
- Copy the Droplet’s public IP from the DigitalOcean dashboard.
- Go to your domain registrar’s DNS panel and update the A record to the new IP.
DNS propagation might take anywhere from a few minutes to several hours (https://bobcares.com/blog/digitalocean-errors-health-check/)
[If needed, Our team is available 24/7 for additional assistance.]
Conclusion
If you follow each step above carefully, you can successfully migrate WordPress to DigitalOcean without breaking anything. It gives you more flexibility, control, and speed. The ability to customize server settings and scale resources easily makes DigitalOcean an ideal choice for WordPress hosting.
0 Comments