Connecting to PostgreSQL on Raspberry via pgAdminIII

Raspberry PI kit after the installation

The first thing to do if you want to connect to PostgreSQL on your Raspberry is to configure PostgreSQL to accept remote connections:

  • Allow incoming/outgoing connections setting firewall rules with iptables:

    $ iptables -A INPUT -i eth0 -p tcp --dport 22 -m state --state NEW, ESTABLISHED -j ACCEPT
    $ iptables -A OUTPUT -o eth0 -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT
                                                                                                                        $ iptables -A OUTPUT -o eth0 -p tcp --dport 22 -m state --state NEW, ESTABLISHED -j ACCEPT
    $ iptables -A INPUT -i eth0 -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT 
  • Edit pg_hba.conf file, insert the following raw:

    host all all XXX.XXX.XXX.XX/32 md5

    Where XXX.XXX.XXX.XX is the IP address of the remote machine.
  • Edit postgresql.conf file, insert the following raw:

    listen_addresses = '*'

    to allow listening from all sources.

…then perform the connection with pgAdminIII

The easiest way to connect with a PostgreSQL server based on a Raspberry PI from a remote machine is to use pgAdminIII. This is a graphical client that can be easily installed on a Debian machine with

   sudo apt-get install pgadmin3

Once is launched, select File from the menu and then select Add server:

fill the fields of the connection form: host name, port number, user and database. If Store password is ticked, credentials are stored in the ~/.pgpass file.

Once the connection is stored, can be used just with a mouse click. Then, Raspberry PI database can be explored with the pgAdminIII browser.

8 thoughts on “Connecting to PostgreSQL on Raspberry via pgAdminIII

  1. Pingback: Connecting to PostgreSQL on Raspberry via psql | Raspberry PG

  2. Excellent submit, very informative. I ponder why the opposite specialists of this sector do not understand this. You must proceed your writing. I am sure, you’ve a huge readers’ base already!|What’s Taking place i’m new to this, I stumbled upon this I’ve found It positively helpful and it has aided me out loads. I’m hoping to give a contribution & help other users like its aided me. Great job.

  3. Thank you for some other wonderful post. Where else may anyone get that kind of information in such an ideal approach of writing? I have a presentation subsequent week, and I am at the search for such information.

  4. Its like you read my mind! You appear to know a lot about this, like you wrote the book in it or something. I think that you could do with a few pics to drive the message home a bit, but other than that, this is wonderful blog. An excellent read. I will certainly be back.

  5. I’m now not sure the place you are getting your information, however great
    topic. I must spend a while studying more or working out more.
    Thanks for fantastic info I used to be on the lookout for
    this information for my mission.

Leave a Reply to senior life insurance Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>