How do I connect Appsmith to a local Mysql/Postgres instance?

When running Appsmith locally on my machine, I’d like to connect to a local Mysql/Postgresql server. Since Appsmith is run via Docker, by default it doesn’t have access to the host machine’s ports. Hence, creating a datasource that connects to localhost:3306 or localhost:5432 doesn’t work.

What do I do?

Linux Instances

You can find the host IP via the command:

ip addr show docker0

The output will be the IP of the of the host machine for that container.

Assuming the output is: , you can then connect to your local databases via: (Mysql) or (Postgresql)

Mac OS X & WSL

You can connect to databases on your host machine via host.docker.internal . So, host.docker.internal:3306 (Mysql) or host.docker.internal:5432 (Postgres)

1 Like