Metabase Database connect mysql localhost error

Hi, I'm new to Metabase and docker and I was trying to add my SQL database to the Metabase I faced this problem and I can't figure out how to solve this.


2025-03-20 16:42:44,733 ERROR driver.util :: Failed to connect to Database
2025-03-20 16:42:44 java.sql.SQLNonTransientConnectionException: Could not connect to address=(host=host.docker.internal)(port=3306)(type=master) : Socket fail to connect to host:host.docker.internal, port:3306. Connection refused

hi @Han910
Welcome to Metabase Discourse.

Can you confirm if your MySQL instance also hosted on Docker?

Hi @bayo99

I am not sure about that. How can I check whether my SQL instance is hosted on Docker?
I created my database using Query in MySQL afterward installed docker and opened up the metabse.
Currently I run Metabase through docker but not the .jar

@Han910

How did you install the MySql instance?

I installed MySQL from the official MySQL website and configured it to run on my localhost with the default port 3306. Am I supposed to change it to host in docker?

Hi @Han910

Since you installed from the official MySql website, you can use your normal connection string to connect the metabase instance.

Check if the answers here help: Connect to mysql in a docker container from the host - Stack Overflow