This blog will take you through connecting the SuperTokens core service with a MySQL or a PostgreSQL database with and without Docker.

This is only applicable if you are self-hosting the SuperTokens core service.

There are several methods for how you might want to run SuperTokens along with a database. In this blog, we will cover:

Please feel free to navigate to the correct section based on your setup. In each section, we will be linking to the SuperTokens documentation wherever applicable so that this blog is not very

lengthy.

All the sections below assume that you will be using a Linux based operating system. For Windows, the syntax for some of the steps might be different, but the overall steps that need to be performed will be the same.

1a) Running SuperTokens and MySQL without docker


1b) Running SuperTokens with Docker and MySQL without docker


For this setup to work, we must connect SuperTokens and MySQL via the host machine’s network. For this, we will have to expose the MySQL db to the local IP.

1c) Running SuperTokens without Docker and MySQL with docker


1d) Running SuperTokens and MySQL with docker, but without docker-compose


1e) Running SuperTokens and MySQL with docker, with docker-compose


2a) Running SuperTokens and PostgreSQL without docker


2b) Running SuperTokens with Docker and PostgreSQL without docker


For this setup to work, we must connect SuperTokens and PostgreSQL via the host machine’s network. For this, we will have to allow PostgreSQL to allow incomming client connections over the network.

2c) Running SuperTokens without Docker and PostgreSQL with docker


2d) Running SuperTokens and PostgreSQL with docker, but without docker-compose



Written by the Folks at SuperTokens — hope you enjoyed! We are always available on our Discord server.