Exporting Databases with WP-CLI

Last Updated -


If you have SSH access, WP-CLI is usually the fastest way to export a copy of your database. In case you're not already familiar with WP-CLI, it's a command line tool for managing WordPress and does a great job at simplifying many common tasks.

Since WP-CLI is an open source tool that's used on most WordPress hosting providers, it's a great host-agnostic solution to use. Whether you're exporting a copy of your WordPress database to move it to Pagely or just making an extra backup for safe keeping it'll work anywhere that WPCLI is installed.

  1. First, open a terminal window and access your site over SSH. If you need more information on how to do this, see one of the following articles:
  2. Next, navigate the the root directory of your site. On a VPS with Pagely, this would be something like:
    cd ~/sites/example.com
  3. Next, you'll want to run the export command, being sure to set the export path. For example, to export your database to your sites directory, you would use the following command:
    wp db export ~/my_export.sql

Once you run the export command, your database will be exported to the path you've defined. Depending on the size of your database, this can sometimes take a little while.

When your backup is finished, just download it using STFP!

Related Topics

Pagely is the Managed WordPress Hosting Platform designed to exceed the needs of media, business, and Enterprise customers alike. We help the world's biggest brands scale WordPress.

Copyright © 2006-2017 Pagely, Inc. All rights reserved.
Pagely® and WordPress® are registered trademarks.

Pagely
Powered by Zendesk