Can't connect to any database

I keep getting this error when trying to connect to the old databases
“Socket fail to connect to host:localhost, port:44487. Connection refused (Connection refused)”

when I try to add a new database I get this error
“No matching clause: Could not connect to address=(host=localhost)(port=40577)(type=master) : Access denied for user ‘admin’@‘172.31.4.234’ (using password: YES) Current charset is UTF-8. If password has been set using other charset, consider using option ‘passwordCharacterEncoding’”

I installed metabase using the elasticbeanstalk method and it was working fine until yesterday

{
  "browser-info": {
    "language": "ar",
    "platform": "Linux x86_64",
    "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36",
    "vendor": "Google Inc."
  },
  "system-info": {
    "file.encoding": "UTF-8",
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "11.0.7+10",
    "java.vendor": "AdoptOpenJDK",
    "java.vendor.url": "https://adoptopenjdk.net/",
    "java.version": "11.0.7",
    "java.vm.name": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "11.0.7+10",
    "os.name": "Linux",
    "os.version": "4.14.173-137.229.amzn2.x86_64",
    "user.language": "en",
    "user.timezone": "GMT"
  },
  "metabase-info": {
    "databases": [
      "mysql",
      "h2"
    ],
    "hosting-env": "elastic-beanstalk",
    "application-database": "postgres",
    "application-database-details": {
      "database": {
        "name": "PostgreSQL",
        "version": "11.6"
      },
      "jdbc-driver": {
        "name": "PostgreSQL JDBC Driver",
        "version": "42.2.8"
      }
    },
    "run-mode": "prod",
    "version": {
      "date": "2020-05-28",
      "tag": "v0.35.4",
      "branch": "release-0.35.x",
      "hash": "b3080fa"
    },
    "settings": {
      "report-timezone": null
    }
  }
}

Hi @sherifAlaa55
Like it says, Access denied for user 'admin'@'172.31.4.234' - so you need to open access on your database.

but I’m using an ssh tunnel for the database connection and it’s working everywhere, plus I don’t know which ip is that

@sherifAlaa55 That’s an local network IP of the server you SSH into I guess. Check the log on MySQL for more details.

after digging around it seems metabase is attempting to connect to the tunnel host it self as that ip is of the tunnel
admin@,

could that be a bug?

@sherifAlaa55 But that’s how the SSH tunnel feature is implemented. If you are tunneling into a jump-host (meaning the database is actually on a different server inside the tunnel-network), then you need to setup your own advanced tunnel:
https://www.metabase.com/docs/latest/administration-guide/01-managing-databases.html#what-if-the-built-in-ssh-tunnels-dont-fit-my-needs