Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Support
  3. Postgres root login info?

Postgres root login info?

Scheduled Pinned Locked Moved Solved Support
postgresql
7 Posts 3 Posters 1.4k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    ChicagoGregg
    wrote on last edited by girish
    #1

    How can I get the Postgres root password for the postgres container?

    I've done it with mysql and tried with postgres, but it keeps saying incorrect password at the psql command line.

    I've done a "docker inspect postgres | grep IPAddress", obtained the IP, and tried to use psql with --user and --host (password pasted in), but it doesn't accept the password. I've connected remotely from through the postgres terminal as well as through the cloudron server, but still no luck.

    This is similar to the steps I've taken as well, found through this link: https://forum.cloudron.io/topic/2200/external-mysql/5

    I installed a Directus RC custom container and didn't realize it was using PG as the DB driver. So, I need to dump the PG tables, convert it to use mysql, and reload the schema into mysql. 🙂

    Thanks!

    -gregg

    nebulonN 1 Reply Last reply
    0
    • C ChicagoGregg

      How can I get the Postgres root password for the postgres container?

      I've done it with mysql and tried with postgres, but it keeps saying incorrect password at the psql command line.

      I've done a "docker inspect postgres | grep IPAddress", obtained the IP, and tried to use psql with --user and --host (password pasted in), but it doesn't accept the password. I've connected remotely from through the postgres terminal as well as through the cloudron server, but still no luck.

      This is similar to the steps I've taken as well, found through this link: https://forum.cloudron.io/topic/2200/external-mysql/5

      I installed a Directus RC custom container and didn't realize it was using PG as the DB driver. So, I need to dump the PG tables, convert it to use mysql, and reload the schema into mysql. 🙂

      Thanks!

      -gregg

      nebulonN Offline
      nebulonN Offline
      nebulon
      Staff
      wrote on last edited by
      #2

      @chicagogregg you should be able to see that using the following command via SSH on your server:

      docker inspect postgresql | grep CLOUDRON_POSTGRESQL_ROOT_PASSWORD
      
      C 1 Reply Last reply
      1
      • nebulonN nebulon

        @chicagogregg you should be able to see that using the following command via SSH on your server:

        docker inspect postgresql | grep CLOUDRON_POSTGRESQL_ROOT_PASSWORD
        
        C Offline
        C Offline
        ChicagoGregg
        wrote on last edited by
        #3

        @nebulon Thanks.

        That's what I thought, too. But I get the following:

        user@vt1cloud01:~$ docker exec -ti postgresql bash
        root@postgresql:/# env|grep CLOUDRON_POSTGRESQL
        CLOUDRON_POSTGRESQL_ROOT_PASSWORD=xxxxxx
        CLOUDRON_POSTGRESQL_TOKEN=xxxxxx
        root@postgresql:/# psql --host=postgresql --user=root --password
        Password: (PASTED PW HERE)
        psql: error: FATAL:  password authentication failed for user "root"
        

        Any other ideas?

        nebulonN 1 Reply Last reply
        0
        • C ChicagoGregg

          @nebulon Thanks.

          That's what I thought, too. But I get the following:

          user@vt1cloud01:~$ docker exec -ti postgresql bash
          root@postgresql:/# env|grep CLOUDRON_POSTGRESQL
          CLOUDRON_POSTGRESQL_ROOT_PASSWORD=xxxxxx
          CLOUDRON_POSTGRESQL_TOKEN=xxxxxx
          root@postgresql:/# psql --host=postgresql --user=root --password
          Password: (PASTED PW HERE)
          psql: error: FATAL:  password authentication failed for user "root"
          

          Any other ideas?

          nebulonN Offline
          nebulonN Offline
          nebulon
          Staff
          wrote on last edited by
          #4

          @chicagogregg you should also be able to connect within the container using this over SSH:

          docker exec -ti postgresql psql --dbname=postgres
          
          C 1 Reply Last reply
          1
          • nebulonN nebulon

            @chicagogregg you should also be able to connect within the container using this over SSH:

            docker exec -ti postgresql psql --dbname=postgres
            
            C Offline
            C Offline
            ChicagoGregg
            wrote on last edited by
            #5

            @nebulon I wasn't specifying any dbname. I'm not totally used to postgres and thought it would just connect into the db instance and I can list databases, etc. from there. Also looks like I can't use a root account to access all databases. It's alright as long as I can get into the schema for directus and transfer things over to MySQL. I'll have to take a primer on postgres.

            Thanks for the help!

            1 Reply Last reply
            0
            • girishG Offline
              girishG Offline
              girish
              Staff
              wrote on last edited by
              #6

              You don't need the root password if you access via localhost since we configured postgres that way.

              root@postgresql:/# psql -Uroot  --dbname=postgres
              psql (12.7 (Ubuntu 12.7-1.pgdg20.04+1))
              Type "help" for help.
              
              postgres=# \list
                                                                                                 List of databases
                              Name                |                Owner                 | Encoding | Collate | Ctype |                               Access privileges                               
              ------------------------------------+--------------------------------------+----------+---------+-------+-------------------------------------------------------------------------------
               db3ef70900294e425783b45e1555c27dd4 | user3ef70900294e425783b45e1555c27dd4 | UTF8     | C       | C     | user3ef70900294e425783b45e1555c27dd4=CTc/user3ef70900294e425783b45e1555c27dd4
               postgres                           | postgres                             | UTF8     | C       | C     | 
               template0                          | postgres                             | UTF8     | C       | C     | =c/postgres                                                                  +
                                                  |                                      |          |         |       | postgres=CTc/postgres
               template1                          | postgres                             | UTF8     | C       | C     | =c/postgres                                                                  +
                                                  |                                      |          |         |       | postgres=CTc/postgres
              (4 rows)
              
              

              Above you can see that db3ef70900294e425783b45e1555c27dd4 is a database. In postgres, there is no "use" like mysql afaik. So you have to reconnect like this:

              root@postgresql:/# psql -Uroot  --dbname=db3ef70900294e425783b45e1555c27dd4
              psql (12.7 (Ubuntu 12.7-1.pgdg20.04+1))
              Type "help" for help.
              
              db3ef70900294e425783b45e1555c27dd4=# \dt
              <the tables>
              
              C 1 Reply Last reply
              1
              • girishG girish

                You don't need the root password if you access via localhost since we configured postgres that way.

                root@postgresql:/# psql -Uroot  --dbname=postgres
                psql (12.7 (Ubuntu 12.7-1.pgdg20.04+1))
                Type "help" for help.
                
                postgres=# \list
                                                                                                   List of databases
                                Name                |                Owner                 | Encoding | Collate | Ctype |                               Access privileges                               
                ------------------------------------+--------------------------------------+----------+---------+-------+-------------------------------------------------------------------------------
                 db3ef70900294e425783b45e1555c27dd4 | user3ef70900294e425783b45e1555c27dd4 | UTF8     | C       | C     | user3ef70900294e425783b45e1555c27dd4=CTc/user3ef70900294e425783b45e1555c27dd4
                 postgres                           | postgres                             | UTF8     | C       | C     | 
                 template0                          | postgres                             | UTF8     | C       | C     | =c/postgres                                                                  +
                                                    |                                      |          |         |       | postgres=CTc/postgres
                 template1                          | postgres                             | UTF8     | C       | C     | =c/postgres                                                                  +
                                                    |                                      |          |         |       | postgres=CTc/postgres
                (4 rows)
                
                

                Above you can see that db3ef70900294e425783b45e1555c27dd4 is a database. In postgres, there is no "use" like mysql afaik. So you have to reconnect like this:

                root@postgresql:/# psql -Uroot  --dbname=db3ef70900294e425783b45e1555c27dd4
                psql (12.7 (Ubuntu 12.7-1.pgdg20.04+1))
                Type "help" for help.
                
                db3ef70900294e425783b45e1555c27dd4=# \dt
                <the tables>
                
                C Offline
                C Offline
                ChicagoGregg
                wrote on last edited by
                #7

                @girish I use DBeaver with an SSH tunnel. I just found an option that I forgot to toggle on -- "Show all databases".

                Now it shows all the databases!

                On a side note, I did first try to configure an SSH tunnel and a post-command to execute "/usr/local/bin/docker exec -ti postgresql bash" and that worked as well.

                But, only one tunnel is needed to the cloudron server to login as root that allows access to all databases.

                I'm good to go. Thanks for the help!

                1 Reply Last reply
                1
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Bookmarks
                • Search