is there any way to see data in database like normally we can connect our postgres database to pgAdmin?

I want to see the data in tables of my database

If you want to check the tables in your database you can do this:

flyctl ssh console --app postgres-app-here
psql -h 127.0.0.1 -U user-you-want-here

Then in psql you can use the command \d to list the tables in your database.

For accessing it through pgAdmin, it’s a bit different. The database is accessed by your other apps over private networks, so you’ll need to make a tunnel between your computer and the database. You can use Wireguard to create a tunnel. Then you can connect to the database in pgAdmin with the internal address (e.g. paulgra-ham.internal) and your credentials.

You can read more about how to setup Wireguard with this reference:

1 Like

It’s gotten even easier! Try flyctl postgres connect for psql, or flyctl proxy to forward a port to your local machine (that you can point pgAdmin to), without setting up your own WireGuard.

More in the Fly Postgres docs

also:

3 Likes

can you please help me in it I’m still not sure how to do it I have tried steps over there but it does nothing for me

usama@Usamas-MacBook-Pro chatapp % flyctl proxy 5432 -a my-db         
usama@Usamas-MacBook-Pro chatapp % psql postgres://postgres:password@localhost:5432
psql (14.1)
Type "help" for help.

postgres=#  

what next?

How to connect fly.io postgres to pg_admin any step by step guide please

1 Like

Did you let the proxy command keep running? You can’t cancel it, it needs to stay running in a tab.

That psql command looks like it might have worked. You could also connect from something like Postico, which is a little easier than a CLI. If you want to use psql you can actually run:

flyctl pg connect -a <db-name>

Then follow these instructions: psql command line tutorial and cheat sheet | postgres


want to connect it here this is not working for me commands are working fine

1 Like

You’ve forwarded the database port to port 5432 on your computer (localhost).

At this point it’s just a matter of setting up pgAdmin or whatever other client you want to use. Server Dialog — pgAdmin 4 6.5 documentation

I would need the same! I’ve been trying to set up my database in Postico and the pg_admin steps aren’t clear to me

did you found the solution?

Hi @cschull and @usama !

This is how I’d set my database to be accessible on localhost.

On your terminal write the command:

$ fly proxy 6543:5432 -a app-name
Proxying local port 6543 to remote [app-name.internal]:5432

This command will expose the port 5432 from your app to your localhost:6543 (feel free to change this number)

On your Postico/Client app do this

The host should be localhost and the port should be the one you choose (in my example 6543).

Read more: Postgres on Fly · Fly Docs

2 Likes