How create postgres Database into vps server step by step

Install PostgreSQL: Start PostgreSQL: Check if PostgreSQL is running Start the Postgres prompt Exit PostgreSQL: \q

Install PostgreSQL:

sudo apt install postgresql postgresql-contrib

Start PostgreSQL:

sudo systemctl start postgresql.service

Check if PostgreSQL is running

sudo service postgresql status

Start the Postgres prompt

sudo -u postgres psql
  1. Run these commands inside PostgreSQL to create a database + user:
CREATE DATABASE databasename;

CREATE USER user WITH ENCRYPTED PASSWORD 'password';

ALTER ROLE user SET client_encoding TO 'utf8';

ALTER ROLE user SET default_transaction_isolation TO 'read committed';

ALTER ROLE user SET timezone TO 'UTC';

GRANT ALL PRIVILEGES ON DATABASE databasename TO user;

\c <database_name> postgres
GRANT ALL PRIVILEGES ON SCHEMA public TO <username>;

Exit PostgreSQL: \q


DATABASE_URL="postgresql://<username>:<password>@localhost:5432/<database_name>?schema=public"
Previous Code

Custom WooCommerce Product Sorting Dropdown

WooCommerce provides a default sorting mechanism f ...

skype

Need Coding Help?

Connect Skype

AI

DATABASE

Jobs

Nextjs

Node

Npm

PHP

Prisma

React

Remix-run

Shopify App

Shopify theme

tailwindcss

Tech

VPS

Woocommerce

WordPress

top