PostgreSQL In Windows Subsystem for Linux (WSL)

sudo apt-get remove postgresql[sudo] password for harshityadav95:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'postgresql' is not installed, so not removed
The following package was automatically installed and is no longer required:
libfreetype6
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
sudo apt-get install postgresql

Postgres User Setup

Using psql

Creating user

$ sudo -u postgres createuser <username>
$ sudo -u postgres createdb <dbname>if getting error:WARNING:  could not flush dirty data: Function not implemented [Ignore for now]
$ sudo -u postgres psql
psql=# alter user <username> with encrypted password '<password>';
psql=# grant all privileges on database <dbname> to <username> ; 

Connecting Postgresql Instance to GUI Client in Windows

Replace the Username , password and database with your config

--

--

--

Software Developer | harshityadav.in

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Harshit Yadav

Harshit Yadav

Software Developer | harshityadav.in

More from Medium

Access Oracle Database XE via Docker

Regex Matching URL

Import/Restore Db (.sql) With Windows CMD

Install PostgreSQL on Windows