Skip to main content

Psql

This guide will walk you through the process of connecting to your RapidApp PostgreSQL database using the psql command-line tool. By the end of this tutorial, you'll be able to establish a connection to your database and start interacting with your data directly from the terminal.

Prerequisites

Before you begin, ensure that you have the following:

  • psql installed on your system. This is typically included with the PostgreSQL installation. If not, you can install it via your package manager or download it from the official PostgreSQL website.
  • PostgreSQL database credentials from Rapidapp:
    • Hostname
    • Port
    • Database
    • Username
    • Password

Step 1: Open a Terminal

  • Open your terminal or command prompt.

Step 2: Connect to the Rapidapp PostgreSQL Database

To connect to your RapidApp PostgreSQL database, use the following psql command:

psql -h your-rapidapp-hostname -p 5432 -U your-username -d your-database
  • -h: Specifies the hostname of the PostgreSQL server.
  • -p: Specifies the port number (default is 5432).
  • -U: Specifies the username to connect with.
  • -d: Specifies the database name. Example:
psql -h db.rapidapp.io -p 5432 -U myusername -d mydatabase

Step 3: Enter Your Password

Once you run the command, you'll be prompted to enter your password:

Password for user myusername:

Enter your password and press Enter.

Step 4: Verify Connection

If the connection is successful, you'll see the psql prompt:

psql (15.7)
Type "help" for help.

mydatabase=>

You're now connected to your Rapidapp PostgreSQL database!

Step 5: Run SQL Queries

You can now run SQL queries directly in the psql interface. For example, to list all tables in your database, you can use:

\dt

To exit the psql interface, type:

\q

Conclusion

Congratulations! You’ve successfully connected to your Rapidapp PostgreSQL database using psql. Now, you're ready to start executing SQL queries, exploring your database schema, and managing your data directly from the terminal.

For more advanced usage and commands, refer to the psql documentation or the Rapidapp Blog.

Happy querying! 🚀