Postgresql – How to switch databases in psql postgresqlpsql In MySQL, I used use database_name; What's the psql equivalent? Best Answer In PostgreSQL, you can use the \connect meta-command of the client tool psql: \connect DBNAME or in short: \c DBNAME Related SolutionsPostgreSQL “DESCRIBE TABLE” Try this (in the psql command-line tool): \d+ tablename See the manual for more info. PostgreSQL: Show tables in PostgreSQL From the psql command line interface, First, choose your database \c database_name Then, this shows all tables in the current schema: \dt Programmatically (or from the psql interface too, of course): SELECT * FROM pg_catalog.pg_tables; The system tables live in the pg_catalog database. Related TopicSql – Save PL/pgSQL output from PostgreSQL to a CSV filePostgresql – psql – save results of command to a filePostgresql: Scripting psql execution with passwordPostgresql – How to exit from PostgreSQL command line utility: psqlPostgresql – Alternate output format for psqlPostgresql – Run a PostgreSQL .sql file using command line argumentsPostgresql – psql: FATAL: role “postgres” does not existPostgresql – psql: FATAL: database “” does not exist
Best Answer
In PostgreSQL, you can use the
\connect
meta-command of the client tool psql:or in short: