Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I access the database from my browser?

I noticed with Postgres and other databases, the database itself runs a local version of a server.

For example, mine is running on localhost:5432.

Curiously, I went to my web browser and tried typing in that address to see what I'd get, but I got a response that "This Web Page is Not Available".

I also tried things like localhost:5432/mydata but also to no avail.

Shouldn't I be able to see something if I visit the database through my web browser? If yes, how do you do it? If not, why not?

like image 752
CodyBugstein Avatar asked Aug 25 '14 18:08

CodyBugstein


2 Answers

Postgres is a service running on a port. A web server is also a service running on a port (80 and/or 443 usually). There are a lot of things running on various ports on any server, heck, on any single computer. That doesn't mean that everything is interchangeable. Ports 80 and 443 are commonly agreed to serve HTTP(S) connections. HTTP is a specific protocol which specifies how two things can communicate on a specific port. Postgres is not speaking HTTP; you need to speak Postgres' particular protocol if you want to talk to it. The browser does not speak that protocol, and Postgres doesn't by default offer communication in any protocol a browser understands.

like image 193
deceze Avatar answered Sep 20 '22 09:09

deceze


A web browser expects to "talk" to servers using a protocol it supports. Webbrowsers support obviously http. Some do support other protocols, like ftp. But your postgres does not speak http. So you don't see anything. The port number is just telling over which channel the server is accessible. Any protocol can be routed over any port, but usually http can be reached over port 80. Your postgress over port 5432.

like image 39
luksch Avatar answered Sep 21 '22 09:09

luksch