Search code examples
postgresqlubuntupgadmin

Cannot Add PgAdmin New Connection on Ubuntu 15.10


After install pgAdmin III from Ubuntu Software Center, I opened it and it required to add a connection to a server. So I filled in information as below:

Adding connection to local server

Upon clicking on Ok Button, it showed the error message

Error connecting to the server: could not translate host name "http://127.0.0.1" to address: Name or service not known

As message indicated, I thought the postgres service was not started. Therefore, I went on go terminal console and start service by entering sudo service postgresql start, but it returned Failed to start postgresql.service: Unit postgresql.service failed to load: No such file or directory. . What's wrong or missing for my pgAdmin III? I'm just using Ubuntu earlier and I have never this problem on windows. Thanks.


Solution

  • http://127.0.0.1 is more a URL, that field is looking for a host so simply remove the http:// to leave the localhost's IP address 127.0.0.1 or type localhost if that resolves to the correct address (it should, usually, via /etc/hosts or the like)

    Also, Debian/Ubuntu tend to ship the database servers separately. For Ubuntu, the postgresql package (which requires postgresql-common) package should include /lib/systemd/system/postgresql.service therefore you should be able to sudo systemctl start postgresql

    Do you have postgresql (as opposed to postgresql-client) installed?