I’ve installed Lemmy via ansible, but I figured out that there are problems with emails and after I’ve created a user, no verification email came, no login is possible and now I have a ghost account I want to delete.

Because I couldn’t find an UI element to purge users in the admin panel, I want to do it over postgresql, but I have no idea how to connect to the Lemmy database over a docker container, only thing I’ve found is to backup/restore the whole database:

docker-compose exec postgres pg_dumpall -c -U lemmy | gzip > lemmy_dump_date +%Y-%m-%d""%H%M_%S.sql.gz

Thank you for your help.

  • maxmoon@lemmy.mlOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    After executing docker exec -it lemmymydomain_postgres_1 psql

    I’ve got the error:

    psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: role "root" does not exist

    • ikornaselur@lemm.ee
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      1 year ago

      Oh yeah, try specifying the hostname as localhost (I think it’s -h, but --help will confirm it). Psql tries by default to connect to that socket, but in docker it does use it.

      Basically, you’ll need to specify the hostname and user (and if port, which should just be default, then -p 5432)

      It should be

      docker exec -it lemmymydomain_postgres_1 psql -h localhost -U lemmy (dbname)

      Keeping in mind that you’ll need to have the right user and database name, assuming (based on your original comment) lemmy being the username and the db name might also be lemmy

      Edit: this should btw just get you into the db, I have no idea of its a good idea or not to delete a user directly from the db, it might cause issues, but I don’t have experience with it, but just generally use postgres in docker with other projects

      • maxmoon@lemmy.mlOP
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        1 year ago

        I found a solution here

        A warning to people who have the same problem:

        On the website there is a command, which will purge all unverified account. If your admin account wasn’t verified, it will be purged, too.

        Thanks a lot for your help :)

        • ikornaselur@lemm.ee
          link
          fedilink
          arrow-up
          0
          ·
          1 year ago

          Glad you solved it! Definitely sounds like a better solution than playing around in the db

          • maxmoon@lemmy.mlOP
            link
            fedilink
            English
            arrow-up
            1
            ·
            1 year ago

            Well, it is playing around with the db 😀 … and it could even destroy the whole instance if people don’t see the warning I’ve posted there.