wp db query <sql>

Executes a SQL query against the database

Arguments

NameDescription
sqlA SQL query. If not passed, will try to read from STDIN

Options

NameDescription
--dbuser <value>Username to pass to mysql. Defaults to DB_USER
--dbpass <value>Password to pass to mysql. Defaults to DB_PASSWORD
--field=valueExtra arguments to pass to mysql. Refer to mysql docs
--defaultsLoads the environment’s MySQL option files. Default behavior is to skip loading them to avoid failures due to misconfiguration