Migrating a WordPress Site using SSH and WP-CLI

Warning

You will require SSH access on the source and destination hosting accounts, as well as the wp-cli command

The following article will detail how to move a WordPress site using SSH and WP-CLI.

Requirements

  • SSH Access to both source and destination hosting accounts.
  • WP-CLI

SSH Access

You need to make sure you have SSH access to both hosting accounts. Typically this is possible with most hosts, however, some don’t allow SSH access. This is purely a personal requirement, due to the fact you ultimately are gaining access to your hosting provider’s server or VPS to migrate the site. This is the lowest level you can complete the migration from, which is ideal as there should be no resource or configuration restrictions to cause technical issues during the migration.

We’re going to login to the destination hosting account via SSH then run commands on the source hosting account via SSH. Sounds odd, but stay with me on this.

Migrate Database

Copy Database

We’re going to use SSH into the destination server via SSH and then run an SSH command to connect to the source server and up WP-CLI to grab a copy of the database.

wpinfo@dest.server.com:~$ ssh wpinfo@src.server.com wp --path=public_html db export wpinfo-wp-sql.sql > /dev/null
wpinfo@dest.server.com:~$ scp cultivat@sh01.lmt.ca:cultiaveyourhealth-wp-sql.sql .

Copy Files

0 Shares:

You May Also Like