Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PgAdmin on Windows 10 with Postgres when installed via Bash on Ubuntu on Windows

I would like to install Rails 5/Postgres within Bash On Ubuntu On Windows and also be able to access Postgres database via PgAdmin for Windows.

Am quiet happy to install all my rails dependencies through Bash on Ubuntu on Windows, but I am aware that I can't run any standard GUI tools from Bash and was wondering if it is possible to install Rails and PostGres on the Linux Subsystem and then query my databases using the Windows version of PgAdmin

I had a look at this tutorial how-to-install-ruby-on-rails-on-windows-10-with-postgresql but it seems that he installs Postgres into windows rather then the Linux Subsystem.

I was wondering if this is the only way to go about getting all these tools working nicely together.

Basically I want my Windows installed PgAdmin to communicate to my Bash On Ubuntu On Windows Postgres DB

like image 766
David Cruwys Avatar asked Aug 16 '17 07:08

David Cruwys


People also ask

Does pgAdmin work on Ubuntu?

PgAdmin is a popular open source management and development tool which is released under PostgreSQL/Artistic license. Different types of database operations can be done easily from the browser by using this software. This software can be used on most popular operating systems.

How do I access pgAdmin in Ubuntu?

Create connection credentials for the server such as hostname, dbname, and Postgres password then save the server settings. After this, we can use the PgAdmin 4 for database management. After server installation, we can use the query tool for database management as shown in the figure below.

How do you check if Postgres is installed correctly on Windows?

The quick way to verify the installation is through the psql program. First, click the psql application to launch it. The psql command-line program will display. Second, enter all the necessary information such as the server, database, port, username, and password.


2 Answers

Here's what I did to connect Postgres DB installed in WSL Ubuntu from Windows pgAdmin.

  1. Launch Ubuntu in Windows.
  2. Start postgres in Ubuntu terminal: sudo service postgresql start
  3. Download the latest pgAdmin and install in Windows.
  4. Launch pgAdmin, a new tab in browser opens; click on Add New Server link.
  5. In the popup Create - Server window in the browser:
    1. General tab: I set Name to localhost
    2. Connection tab: I set Host name/address to localhost, set Password to postgres, which is the default, click on Save password?
    3. I save the setting, leaving the rest of the fields as is
  6. That's it, I can see the DB created in Postgres immediately.

Browser screenshot on adding a server

like image 142
kiatng Avatar answered Sep 26 '22 08:09

kiatng


The answer provided by @kiatng helped me too. However, I was getting a socket not connected error when I was trying to access the data in my tables. Through another Google search, I found I needed to change localhost to 127.0.0.1 and then I was able to access the data. Just putting this here in case it helps someone else. I would have replied to kiatng's answer but I don't quite have enough 'reputation' yet to do so!

like image 21
Catriona Bennett Avatar answered Sep 24 '22 08:09

Catriona Bennett