0

I am having a Postgres database deployed. When I connect to it using pgAdmin I see so many databases that I don't have access to and I haven't created at all.

The picture shows some of them. My actual database is one of them.

What are these database and why are they here? How can get rid of them? Can I just delete them without any problem?

enter image description here

Lee Maan
  • 699
  • 3
  • 10
  • 30

2 Answers2

3

If this is your database, then you better know what databases you have and why you have them.

One possibility is that you have lost control of your database, probably to cryptomining hackers (they do create databases with gibberish names).

You can delete the extra's, but the hackers will just keep on getting back in if you don't fix the underlying problem. You need to give good passwords to all your superuser accounts (and all non-superuser accounts too), block access to your database to all but white-listed hosts in pg_hba.conf, maybe block super-user access from all but localhost, as well as blocking access to 5432 on your firewall to all but trusted hosts. Any one of these might be sufficient, but you will be better off to do all 4 of these things.

jjanes
  • 37,812
  • 5
  • 27
  • 34
  • Thanks for the answer! I highly doubt my DB is hacked since its security is super tight and it's still nearly empty in staging phase. These DBs show only by pdAdmin. When I used the command line I don't find them. I can't access them. I can access only mine, which shows in the list (down) without a red 'x' on it. I'll read more, but if you may have any other explanation please share. – Lee Maan Sep 24 '19 at 16:17
  • "When I used the command line I don't find them" What do you do on the command line to list them? Are you sure you are connecting to the same system each time? – jjanes Sep 24 '19 at 16:23
  • What is your security like? Cryptomining hackers don't care if your database is nearly empty. – jjanes Sep 24 '19 at 16:25
  • I think I figured it out. My host is Heroku. It turned out that Heroku hosts a Hobby tire DB in a common (shared) area where pgAdmin can see the other DBs sharing the same space, but accessing them isn't possible. When I upgraded to a production DB the rest of the DBs disappeared because it not in a shared pool. Thanks for the help! – Lee Maan Sep 27 '19 at 12:42
0

I faced the same issue using Heroku Postgres addon...

The solution was setting DB Restriction in Advanced options.

enter image description here

Setting your database there you will only see your DB and not the other.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Ferticidio
  • 1,099
  • 1
  • 8
  • 3