Skip to content

Export a SQL file from a site not hosted at WordPress VIP

To migrate the content of a WordPress site to an environment on the WordPress VIP Platform, a SQL database file must be exported from the non-WPVIP site. Not all of the methods described on this page are available on all hosting platforms. Refer to the documentation for the existing site’s hosting platform to identify which methods are available and access more information on how to use them.

Some methods described on this page can be used to export SQL database files from a WordPress site currently running on a VIP Local Development Environment.

Database export plugins

Third-party plugins that are designed to export WordPress database content can be installed on a non-WPVIP site or on a VIP Local Development Environment in order to migrate the content. Find a database export plugin that best matches a customer’s criteria by reviewing available options in WordPress.org’s Plugins library.

Database exports in the command line

In some cases, the database of a WordPress site can be exported by running a mysqldump command in a command line interface. This command example demonstrates a mysqldump command formatted to output a database file that is most likely to be suitable for import to a WPVIP Platform environment:

mysqldump --add-drop-table --hex-blob --no-create-db --quote-names -h dbhost -u user -p dbname --default-character-set=utf8mb4 --result-file=dbname-full.sql

Database exports with WP-CLI

When available, the wp db export WP-CLI command can be export all or some of a WordPress site’s database tables. Refer to the WordPress Developer Resources for WP-CLI for usage examples and options for the wp db export command.

VIP Local Development Environment

To run wp db export on a WordPress sites currently running on a VIP Local Development Environment, use the vip dev-env exec VIP-CLI command.

In this example command, the database file of a local environment with the --slug value of example-site is exported to the user’s Desktop directory with the file name example-export.sql. The -q option is included to suppress informational messages from being output and subsequently included in the exported file. The - > operator is directing the output to STDOUT and writing the file to a location that is easily retrievable by the user.

vip dev-env exec --slug=example-site -q -- wp db export - > /Users/example-user/Desktop/example-export.sql

Database exports from phpMyAdmin

It is possible to use phpMyAdmin to export a database file from a WordPress site that is suitable for import to a WPVIP Platform environment. However this option should be taken with great caution.

Exports from phpMyAdmin are highly configurable and some settings might include SQL statements that are not compatible with VIP’s import tooling (e.g., CREATE DATABASE IF NOT EXISTS, USE, ALTER USER, or SET PASSWORD).

Before importing a database file that was exported with phpMyAdmin to a VIP Platform environment, use VIP-CLI to validate that the SQL database file is compatible.

VIP Local Development Environment

phpMyAdmin is an optional stack service that can be enabled on a VIP Local Development Environment. Enable phpMyAdmin for a local environment by passing -p=y or --phpmyadmin=y with the vip dev-env create or vip dev-env update commands. Once enabled, the web URL for phpMyAdmin can be retrieved by running vip dev-env info against the running environment.

Last updated: November 13, 2024

Relevant to

  • WordPress