Connection Refused

sometimes I got this error if I idle or open Metabase for the next day
Socket fail to connect to host:localhost, port:43003. Connection refused (Connection refused)
but if I resave the database configuration without editing I got normally.

i am running on a different server Metabase with database want to monitoring

Hi @herdikun
You are seeing this issue: - upvote by clicking :+1: on the first post
The workaround is to setup the tunnel outside of Metabase and use that instead of the built-in tunnel:

this issue is still open and i didnt find the solution, what can i do for this issue?

@herdikun Correct the issue is still open. Like I wrote, you would have to setup a SSH tunnel outside of Metabase manually - that’s the workaround.

Sorry, i am a newbie. can you explain more about this
ssh -Nf -L input-port:internal-server-name:port-on-server
what is
internal-server-name = this is Metabase server?

@herdikun SSH is a fairly large subject by itself and there are many tutorials on the internet to learn more about it.
I don’t know your setup, so you might you need to search the internet for more information, since it is not specific to Metabase.

If you do something like this:
ssh -Nf -L
You would then connect in Metabase to localhost on port 4321, and the SSH tunnel would then connect to the bastion, which would then try to connect to on port 1234. If the database is on your bastion, then you would just use localhost instead of

Hi @flamber,

I am having a similar issue with my Metabase connection.
I have tried what you prescribed in:

but still getting the same connection error once I am idle for few minutes
I am running two remote servers, one is where I installed the docker metabase and the other server is where I have my MySQL database
I set up ssh connection as follows:
ssh -Nf -L “server-running-metabase-port:db-localhost:db-localhost-port username@db-server-ip”
Am I missing anything?

@tunde Make sure that you are not using the builtin SSH tunnel toggle in Metabase, since you’re handling it manually.

Hi @flamber,

When I tried that, am not able to connect at all. Attach image is my configuration

@tunde Post “Diagnostic Info” from Admin > Troubleshooting.
And post the non-redacted SSH command - you’re redacting too much. I don’t know if you have actually setup a tunnel on localhost listening on port 3306

Hi @flamber,

“browser-info”: {
“language”: “en-GB”,
“platform”: “Win32”,
“userAgent”: “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36”,
“vendor”: “Google Inc.”
“system-info”: {
“file.encoding”: “UTF-8”,
“”: “OpenJDK Runtime Environment”,
“java.runtime.version”: “11.0.7+10”,
“java.vendor”: “AdoptOpenJDK”,
“java.vendor.url”: “”,
“java.version”: “11.0.7”,
“”: “OpenJDK 64-Bit Server VM”,
“java.vm.version”: “11.0.7+10”,
“”: “Linux”,
“os.version”: “5.8.0-41-generic”,
“user.language”: “en”,
“user.timezone”: “GMT”
“metabase-info”: {
“databases”: [],
“hosting-env”: “unknown”,
“application-database”: “h2”,
“application-database-details”: {
“database”: {
“name”: “H2”,
“version”: “1.4.197 (2018-03-18)”
“jdbc-driver”: {
“name”: “H2 JDBC Driver”,
“version”: “1.4.197 (2018-03-18)”
“run-mode”: “prod”,
“version”: {
“date”: “2021-01-13”,
“tag”: “v0.37.6”,
“branch”: “release-x.37.x”,
“hash”: “344e5e0”
“settings”: {
“report-timezone”: “Europe/London”

Hi @flamber,

I have setup SSH tunnel to the localhost of my mysql database to port 3306

Are you running Docker?
Or do you have anything blocking the Metabase java-process from accessing localhost:3306 ? You can use any other tool to test that - even just telnet:

telnet localhost 3306

Latest release is 0.37.8 and you should migrate away from H2 (unrelated to your current problem):

Hi @flamber,
Yes, I am using Metabase docker, but my mysql database is not running on docker.
I am able to telnet localhost 3306 from the metabase server host to mysql database host.
Do I need special configuration if I am running metabase docker?

@tunde You have to remember that a docker container is a “server” by itself, so localhost inside of a container is the container itself - not the host.

Hi @flamber,

Thanks for your help.
It is finally working now

Hi @tunde,
I am facing the same issue, Metabase server is running on docker, where DB is running on the host machine, on which docker is running.

Can you let me know what you did to resolve the issue?

@srinivas Try clicking the link I posted. You need to use host.docker.internal as the host address.
If you are not very familiar with Docker, then I would recommend using JAR instead.

hi @flamber
I have used host.docker.internal as hostname while adding the database on Metabase but I am getting same error


  1. Post "Diagnostic Info" from Admin > Troubleshooting.
  2. Figure out what your Docker host IP address is and try that
  3. Make sure you don't have some firewalls blocking and that the process is actually listening on the interface and port.
  4. Otherwise use JAR.