By WTPX
My current LAMP droplet is having issues updating mysql and apache so I am planning on moving the DB and web files to a new droplet. What is the best way to move all of these things but not move any of the out dated server install?
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!
Heya,
Here’s the best approach to migrate just your data and web files to a new LAMP droplet:
Export from old server:
# Create a dump of all databases (excluding system databases)
mysqldump --all-databases --single-transaction --routines --triggers --user=root -p > all_databases.sql
# Or export specific databases:
mysqldump -u root -p database_name > database_name.sql
Import to new server:
# Transfer the file to new server, then:
mysql -u root -p < all_databases.sql
Copy web files (excluding system files):
# From old server, tar your web content
cd /var/www
tar -czf web_files.tar.gz html/
# Transfer to new server (use scp, rsync, or similar)
scp web_files.tar.gz user@new-server-ip:/var/www/
On new server:
cd /var/www
tar -xzf web_files.tar.gz
chown -R www-data:www-data html/
chmod -R 755 html/
Only copy application-specific configs:
/etc/apache2/sites-available/
wp-config.php
, .env
files)Don’t copy these system files:
apache2.conf
)php.ini
)my.cnf
)This approach gives you a clean, updated server environment while preserving all your data and applications.
Since we don’t know your setup, we can’t guide you here but bear in mind that if you have some services that go alongside your application like NodeJS or Gunicorn or w/e, you will need to move them over as well.
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.