CLI Reference
Command Syntax
Section titled “Command Syntax”pgxcli [DBNAME] [USERNAME] [flags]Connection Flags
Section titled “Connection Flags”--host, -h
Section titled “--host, -h”Host address of the PostgreSQL database.
- Type:
string - Default:
localhost
--port, -p
Section titled “--port, -p”Port number for the PostgreSQL server.
- Type:
integer - Default:
5432
--user, -u, -U
Section titled “--user, -u, -U”Username to connect as.
- Type:
string - Required: Yes (unless provided as positional argument)
--dbname, -d
Section titled “--dbname, -d”Database name to connect to.
- Type:
string - Required: Yes (unless provided as positional argument)
--password, -W
Section titled “--password, -W”Force password prompt before connecting.
- Type:
boolean - Default:
false
--no-password, -w
Section titled “--no-password, -w”Never prompt for password.
- Type:
boolean - Default:
false
Other Options
Section titled “Other Options”--debug
Section titled “--debug”Enable debug mode for verbose logging.
- Type:
boolean - Default:
false
--help
Section titled “--help”Show help message and exit.
Special Commands
Section titled “Special Commands”Inside the interactive REPL, you can use PostgreSQL special commands:
\d [pattern]- List tables, views, and sequences\l- List databases\dt- List tables only\q- Quit the application- And many more standard PostgreSQL backslash commands
Environment Variables
Section titled “Environment Variables”You can use standard PostgreSQL environment variables:
PGHOST- Database hostPGPORT- Database portPGUSER- Database userPGDATABASE- Database namePGPASSWORD- Database password (not recommended for security reasons)