# Connect to PostgreSQL DB

**URL:** https://discuss.tryton.org/t/connect-to-postgresql-db/3017
**Category:** System Administrator
**Created:** [July 13, 2020, 5:08pm UTC](https://discuss.tryton.org/t/connect-to-postgresql-db/3017 "2020-07-13T17:08:37Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![TelematicMan](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/t/58956e/32.png) [@TelematicMan](https://discuss.tryton.org/u/TelematicMan)
#### Post date: [July 13, 2020, 5:08pm UTC](https://discuss.tryton.org/t/connect-to-postgresql-db/3017/1 "2020-07-13T17:08:37Z")

</div>

I am unable to connect to the Postgre DB remotely. I suspect I do not have the Postgres database daemon set up and listening for connection on port 5432. Does anyone know the command to start the daemon and make it persistent Thanks!

---

<div class="post-metadata">

### Author: ![edbo](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/e/f14d63/32.png) [@edbo](https://discuss.tryton.org/u/edbo)
#### Post date: [July 13, 2020, 6:00pm UTC](https://discuss.tryton.org/t/connect-to-postgresql-db/3017/2 "2020-07-13T18:00:05Z")

</div>

`systemctl start postgresql` to start the daemon and `systemctl enable postgresql` to make it start on boot.

---

<div class="post-metadata">

### Author: ![TelematicMan](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/t/58956e/32.png) [@TelematicMan](https://discuss.tryton.org/u/TelematicMan)
#### Post date: [July 13, 2020, 6:32pm UTC](https://discuss.tryton.org/t/connect-to-postgresql-db/3017/3 "2020-07-13T18:32:35Z")

</div>

Thank you thats what I thought it was but I thought I had it wrong as this is the return

```auto
# systemctl start postgresql
Failed to start postgresql.service: Unit postgresql.service not found.

```

However my Tryton site is up and running

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [July 13, 2020, 7:51pm UTC](https://discuss.tryton.org/t/connect-to-postgresql-db/3017/4 "2020-07-13T19:51:44Z")

</div>

> [@TelematicMan](#):
>
> Tryton site is up and running

How did you setup tryton? Using docker images?

---

<div class="post-metadata">

### Author: ![TelematicMan](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/t/58956e/32.png) [@TelematicMan](https://discuss.tryton.org/u/TelematicMan)
#### Post date: [July 13, 2020, 8:17pm UTC](https://discuss.tryton.org/t/connect-to-postgresql-db/3017/5 "2020-07-13T20:17:30Z")

</div>

Yes Sir  
Following and using these instructions

[https://hub.docker.com/r/tryton/tryton/](https://hub.docker.com/r/tryton/tryton/)

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [July 14, 2020, 6:47am UTC](https://discuss.tryton.org/t/connect-to-postgresql-db/3017/6 "2020-07-14T06:47:45Z")

</div>

> [@TelematicMan](#):
>
> Following and using these instructions
> 
> [https://hub.docker.com/r/tryton/tryton/](https://hub.docker.com/r/tryton/tryton/)

The tryton docker image uses the [postgres docker image](https://hub.docker.com/_/postgres). So if you want to conect to it locally you should follow it’s instructions.

If you want to access the image localy you can use the psql command insede the postgres image.

---

<div class="post-metadata">

### Author: ![TelematicMan](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/t/58956e/32.png) [@TelematicMan](https://discuss.tryton.org/u/TelematicMan)
#### Post date: [July 14, 2020, 1:17pm UTC](https://discuss.tryton.org/t/connect-to-postgresql-db/3017/7 "2020-07-14T13:17:36Z")

</div>

Pokoli Thanks for the info. One more clarification to make sure I have the Database password correct when I run this cmd

```auto
docker run --link tryton-postgres:postgres -e DB_PASSWORD=mysecretpassword -it tryton/tryton trytond-admin -d tryton --all

The return will ask me to enter an Email address and the admin password.

The password entered at that point will be the admin / super user password for the PostgreSQL database correct?

Thanks!

```

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [July 14, 2020, 1:33pm UTC](https://discuss.tryton.org/t/connect-to-postgresql-db/3017/8 "2020-07-14T13:33:46Z")

</div>

> [@TelematicMan](#):
>
> ```auto
> The password entered at that point will be the admin / super user password for the PostgreSQL database correct?
> 
> ```

No the password entered on the `trytond-admin` comand is the one of the admin user of the tryton database.

The password of the Postgres database is the one indicated in the DB\_PASSWORD environment variable, which is _mysecretpassword_ in your case

---

<div class="post-metadata">

### Author: ![TelematicMan](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/t/58956e/32.png) [@TelematicMan](https://discuss.tryton.org/u/TelematicMan)
#### Post date: [July 14, 2020, 2:05pm UTC](https://discuss.tryton.org/t/connect-to-postgresql-db/3017/9 "2020-07-14T14:05:19Z")

</div>

Thank you. Thats why the misunderstanding I should have changed

“DB\_PASSWORD=mysecretpassword”  
to

DB\_PASSWORD=MYNEWDIFFRENTpassword

What is the best proper to change the the DB password with out breaking anything or the connection to Tryton Container?

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [July 15, 2020, 6:54am UTC](https://discuss.tryton.org/t/connect-to-postgresql-db/3017/10 "2020-07-15T06:54:56Z")

</div>

> [@TelematicMan](#):
>
> What is the best proper to change the the DB password with out breaking anything or the connection to Tryton Container?

You should backup your database, recreate the postgresql container with the new DB\_PASSWORD environment variable and restore the database on the new created container.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [July 15, 2020, 7:09am UTC](https://discuss.tryton.org/t/connect-to-postgresql-db/3017/11 "2020-07-15T07:09:23Z")

</div>

Or you can connect to the database and change the password of the user `postgres` like explained in [https://stackoverflow.com/questions/12720967/postgresql-how-to-change-postgresql-user-password#12721095](https://stackoverflow.com/questions/12720967/postgresql-how-to-change-postgresql-user-password#12721095)

---

<div class="post-metadata">

### Author: ![TelematicMan](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/t/58956e/32.png) [@TelematicMan](https://discuss.tryton.org/u/TelematicMan)
#### Post date: [July 15, 2020, 2:05pm UTC](https://discuss.tryton.org/t/connect-to-postgresql-db/3017/12 "2020-07-15T14:05:53Z")

</div>

Thank you Sirs. I will get it done!
