DEV Community

Tao Liu
Tao Liu

Posted on • Edited on

How to start PgSQL (Postgres) server

Try directly using:

sudo /etc/init.d/postgresql start

otherwise try:

pgrep -u postgres -fa -- -D

More info:
How to start Postgres
There again are several ways to start Postgres. If you’re running a Debian-based distribution, you should find the perl wrappers pretty handy.

For Debian or Debian-based (including Ubuntu) Linux distributions
First, issue pg_lsclusters to find out your cluster name:

pg_lsclusters

Ver Cluster Port Status Owner Data directory Log file
12 main 5432 online postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log

To start that particular cluster, you just need to issue:

pg_ctlcluster <Version> <Name> start

So, in our example, it will be:

pg_ctlcluster 12 main start

if that gives an error, use:

sudo /etc/init.d/postgresql start

You may need to then run:

584 rake db:drop
586 rake db:create
587 rake db:migrate
588 rake db:seed

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay