In Serverpod the connection details and password for the database are stored inside the
config directory in your server package.
Serverpod automatically establishes a connection to the Postgresql instance by using these configuration details when you start the server.
Each environment configuration contains a
database keyword that specifies the connection details.
For your development build you can find the connection details in the
This is an example:
name refers to the database name.
The database password is stored in a separate file called
passwords.yaml in the same
config directory. The password for each environment is stored under the
database keyword in the file.
An example of this could look like this:
database: '<MY DATABASE PASSWORD>'
A newly created Serverpod project comes with a preconfigured docker instance with Postgresql. All you have to do is run the following command from the root of the
server package to start the database.
Docker is required for this to work.
$ docker compose up --build --detach
To remove the database run (this commands preserve all data).
$ docker compose down
To remove the database and delete all data add the
$ docker compose down -v