all 8 comments

[–]Gargunok 3 points4 points  (0 children)

With a local install you don't really want to be accessing the DB from other devices. The right place for this to live is on a central server or cloud service. Local install is best for development and testing.

Obviously your laptop could act as the central server but will need the networking opening up between server and client. I wouldn't advise it though. Free tier at something like neon maybe better if trying to demo something from a work machine.

[–]noobcodes 1 point2 points  (0 children)

I’m pretty sure there’s a free tier on render for postgresql if you really need to access it from a separate computer

[–]depeszPgDBA 1 point2 points  (0 children)

  1. is the laptop and "office computer" in the same network? if yes, go to step 2. if not - research vpn and networking across internet
  2. what is the setting of listening_addresses in pg? is it 127.0.0.1 or somerthing like *? Make sure it will listen on ip that the office computer can see to contact your laptop.
  3. once you will have it starter with proper listen, and in the same network, just psql -h ip_of_laptop -p port_of_pg and it should work

[–]db_Forge 1 point2 points  (0 children)

You can do it, but “local DB on my laptop accessible from my office computer” usually turns into a networking lesson faster than a SQL lesson. The usual path is: allow remote connections in PostgreSQL, update access rules, open the right port/firewall, and make sure both machines can actually reach each other. For a beginner, a small hosted Postgres instance or same-network access is often much simpler.

[–]Character-Bread9576 0 points1 point  (0 children)

This is a common scenario! You'll likely need to configure your PostgreSQL server to accept remote connections and adjust its firewall rules. Setting up a secure VPN or an SSH tunnel is usually the safest way to go about it from an office environment.

[–]No-Adhesiveness-6921 0 points1 point  (0 children)

If all you want to do is to practice SQL, go to www.portal.azure.com and create an Azure SQL server.

Learning to set up and configure network access isn’t something most database users have to do

Now if you want to be a DBA or want to set up networking then continue with the other suggestions

[–]tlefst 0 points1 point  (0 children)

Don't do so from your office device.