Skip to main content

db:query

Run a raw DB query

warning

Running raw SQL queries can affect your database and should be done with caution, especially in production environments. Always review your queries before execution.

n98-magerun2.phar db:query [--connection=CONNECTION] [--only-command] [<query>]

Arguments:

ArgumentDescription
querySQL query

Options:

OptionDescription
--connection=CONNECTIONSelect DB connection type for Magento configurations with several databases
--only-commandPrint only mysql command. Do not execute

Example:

n98-magerun2.phar db:query "select * from store"