Skip to main content

Run SQL Command

The run:sql command allows you to execute raw SQL queries or files directly from the command line.

Usage

npx hysteria run:sql "SELECT * FROM users;"
npx hysteria run:sql --file ./scripts/my-query.sql
yarn hysteria run:sql "SELECT * FROM users;"
yarn hysteria run:sql --file ./scripts/my-query.sql

Options

  • -f, --file [path]: Path to the SQL file to execute.
  • -h, --host [host]: Database host.
  • -d, --database [database]: Database name.
  • -u, --username [username]: Username.
  • -p, --password [password]: Password.
  • -t, --type [type]: Database type (postgres, mysql, etc.).

Example

npx hysteria run:sql -t postgres -h localhost -d test -u root -p root -f ./scripts/init.sql
yarn hysteria run:sql -t postgres -h localhost -d test -u root -p root -f ./scripts/init.sql

Back to: CLI Overview