PostgreSQL Installation
PostgreSQL
When working with MEDUSA for ecommerse, you will need to use postgresql. Here will will look into how to install and confugure postgresql before installing MEDUSA bbackend, so that the MEDUSA installation goes smoothly.
For installing postgresql in ubuntu first add the postgresql repository
Retrieve and adds the PostgreSQL repository's GPG (GNU Privacy Guard) key to your system
Install Postgresql
Check installation using version command
Access PostgreSQL
To access postgresql type "psql" but this will generate error
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: role "username" does not exist
As the default configuration of Postgres is, a user called postgres is made on and the user postgres has full superadmin access to entire PostgreSQL instance running on your OS.
The DB console cn be accesed using the below command, by passing the username along with 'psql'
Incase the above steps doesnot work Create as password for postgres user
Enter the new password and switch to this user acount, by using this newly created password
Now you can use the command 'psql' to enter into DB consile. To list all the database and owners use the '\l' command on the DB console. Command '\q' is used to exit the terminal
Configure PosrgreSQL for Medusa
When installing MEDUSA backend, it asks for creating psotgresql DB. if the default user is not regitered with postgres DB then the process of DB creation will fail.
To prevent this we create a new user (medusa_adim) in postgresql DB with a known password and will provide these credentials while instaling MEDUSA backen. This will ensure that necesary DB is created and linked to MEDUSA.
In the DB console type
Now provide the newly created user with Database creation rights
This should be enough for MEDUSA installation to go through one you provide youruser and yourpass
Other Actions in PostgreSQL
All the commands are self explanator
Last updated