
How do I specify a password to 'psql' non-interactively?
From the official documentation: psql It is also convenient to have a ~/.pgpass file to avoid regularly having to type in passwords. See Section 30.13 for more information. 30.13. The Password File This …
How to use “psql” to connect to PostgreSQL in SSL mode?
I am trying to configure SSL certificate for PostgreSQL server. I have created a certificate file (server.crt) and key (server.key) in data directory and update the parameter SSL to "on" to
PostgreSQL: Remotely connecting to Postgres instance using psql …
I want to remotely connect to a Postgres instance. I know we can do this using the psql command passing the hostname I tried the following: psql -U postgres -p 5432 -h hostname I modified the /etc/
sql - What is the difference between "psql -c" and "psql -f" when ...
Jan 16, 2019 · psql -f create_schema_and_table.sql My questions are: What is the difference between executing queries with "psql -c" and "psql -f"? How can the same result be achieved programatically, …
How to show data in a table by using psql command line interface?
Mar 26, 2020 · Is there a way to show all the content inside a table by using psql command line interface? I can use \list to show all the databases, \d to show all the tables, but how can I show all …
Run PostgreSQL queries from the command line - Stack Overflow
Jul 17, 2025 · psql -U username -d mydatabase -c 'SELECT * FROM mytable' If you're new to postgresql and unfamiliar with using the command line tool psql then there is some confusing …
postgresql - How to switch databases in psql? - Stack Overflow
Oct 16, 2010 · 2 You can list all the databases in the psql terminal using \l or \list. To select a database you can use \c dbname or \connect dbname. [INFO] You cannot use this commands in pgAdmin.
How do you use script variables in psql? - Stack Overflow
This only works in psql but doesn't work with -c / --command; you have to send the command via stdin or via -f. It won't work in (say) PgAdmin-III too. This substitution happens during input processing in …
How to list databases in terminal in PostgresSQL?
I'm experienced with MySQL, but I've just started to work with Postgres - from the terminal, how can I see the list of existing Postgres databases using the psql command? I checked the documentatio...
PostgreSQL: Why psql can't connect to server? - Stack Overflow
Mar 19, 2019 · I typed psql and I get this: psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgr...