In WSL How to create database , Update Password and connect the database in any application

 


Make sure, we have postgres installed, run below query to verify that.



Run the below command to install pg_ctlcluster utility

command: sudo apt install postgresql postgresql-contrib



Run the below command to start the postgresql manually




Run the below command to postgres user

sudo -i -u postgres
psql


Run command createdb my_database to create a new database




Run the command psql -l to list the list of database 



From your current prompt (postgres@...$), enter the PostgreSQL shell:

psql


Now, paste this command to change the password for postgres user

 ALTER USER postgres WITH PASSWORD 'your_secure_password';




Now we can see like below



Type \q to exits the PostgreSQL shell and brings you back to the Linux terminal 



I installed the below extension in visual studio


Select postgresSQL and provide the database details with password and click on Connect button.


Now, we can see the database details inside visual studio




Lets

Thank you!

Comments

Popular posts from this blog

How to build MCP Server and use MCP Inspector in Node

How to install ngrok in wsl for activepieces