A
A
Andrey Volchara2020-10-26 19:31:23
Python
Andrey Volchara, 2020-10-26 19:31:23

Why is postgreSQL not working?

Previously I used sqlite in my "mini project", but as it turned out, heroku only accepts postgreSQL.
Installed postgres, psycopg2 module. I run, I get 0 reactions. There are no errors, there is nothing .. But as I understand it, nothing happens. What am I doing wrong?

import psycopg2

connection = psycopg2.connect(
  host="localhost", 
  port = 50307, 
  database="bot", 
  user="postgres", 
  password="vollchara.mp4"
)
cursor = connection.cursor()
print("Database opened successfully")

5f96f9a2a5318581719108.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Zanak, 2020-10-26
@vollchara

Did you install postgree?
The normal port for postgres is 5432. When you specify localhost to pgadmin and that port is the connection made? For the postgres user with the password specified during installation, authorization passes?
Get a successful connection with psql or pgadmin, then get to grips with python. It will be really faster, in the sense of understanding what exactly did not work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question