User Tools

Site Tools


computing:migratewp

This is an old revision of the document!



  • migratewp
  • Jonathan Haack
  • Haack's Networking
  • netcmnd@jonathanhaack.com

migratewp


This tutorial is designed to step one through how to migrate a self-hosted Word Press site manually. First, authenticate as root on the old host and backup your entire database.

sudo -i
/usr/bin/mysqldump    \
--add-drop-database \
--all-databases     \
--allow-keywords    \
--comments          \
--complete-insert   \
--lock-all-tables   \
--skip-dump-date    \
--events            \
--flush-logs        \
--flush-privileges  \
--hex-blob          \
--opt               \
--routines          \
> mysqldump-all-databases.sql

The spacing is optional and thanks to @jjscha for providing a great template to use. This can and should be used as a backup script. You can find the latest version mysql-backup.sh. Now that your database is secure, let's import that database into the new host as follows:

mysql -u user -h localhost -p < /path/to/mysqldump-all-databases.sql

This will take some time. Once it finishes, log into the mysql command mode and verify the databases made it over:

mysql -u user -p
> SHOW DATABASES;
> EXIT

Run this command on both machines, and the output should be identical. Now, it is time to migrate the website over:

scp -r /var/www/website.com user@newhost.com:

Put the files in the appropriate locations, obviously make sure you set up TLS again if needed and check file permissions for the directories, but that should be it. Your WP website is now on the new host. Of course, also make appropriate DNS / port forwarding adjustments so that the new website is accessible.

oemb1905 2019/02/17 22:06

computing/migratewp.1550468741.txt.gz · Last modified: 2019/02/18 05:45 by oemb1905