wp db

Perform basic database operations using credentials stored in wp-config.php

GitHub Issues

EXAMPLES

# Create a new database.
$ wp db create
Success: Database created.

# Drop an existing database.
$ wp db drop --yes
Success: Database dropped.

# Reset the current database.
$ wp db reset --yes
Success: Database reset.

# Execute a SQL query stored in a file.
$ wp db query < debug.sql

SUBCOMMANDS

Name Description
wp db check

Check the current status of the database.

wp db cli

Open a MySQL console using credentials from wp-config.php

wp db create

Create a new database.

wp db drop

Delete the existing database.

wp db export

Exports the database to a file or to STDOUT.

wp db import

Import a database from a file or from STDIN.

wp db optimize

Optimize the database.

wp db query

Execute a SQL query against the database.

wp db repair

Repair the database.

wp db reset

Remove all tables from the database.

wp db tables

List the database tables.