How to switch databases in psql?
In MySQL, I used use database_name; What’s the psql equivalent? 1 15
In MySQL, I used use database_name; What’s the psql equivalent? 1 15
How can I drop all tables in PostgreSQL, working from the command line? I don’t want to drop the database itself, just all tables and all the data in them. 30 30 If all of your tables are in a single schema, this approach could work (below code assumes that the name of your schema … Read more
How do I change the password for PostgreSQL user? 2 22 To log in without a password: sudo -u user_name psql db_name To reset the password if you have forgotten: ALTER USER user_name WITH PASSWORD ‘new_password’;
What command or short key can I use to exit the PostgreSQL command line utility psql? 8 Type \q and then press ENTER to quit psql. UPDATE: 19-OCT-2018 As of PostgreSQL 11, the keywords “quit” and “exit” in the PostgreSQL command-line interface have been included to help make it easier to leave the command-line tool.
How do you perform the equivalent of Oracle’s DESCRIBE TABLE in PostgreSQL (using the psql command)? 2 22 Try this (in the psql command-line tool): \d+ tablename See the manual for more info.
What’s the equivalent to show tables (from MySQL) in PostgreSQL? 2 26 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.