docs/go/primitives/database-troubleshooting.md
When you run your application locally with encore run, Encore provisions local databases using Docker. If this fails with a database error, it can often be resolved by making sure you have Docker installed and running, or by restarting the Encore daemon using encore daemon.
If this does not resolve the issue, here are steps to resolve common errors:
** Error: sqldb: unknown database **
This error is often caused by a problem with the initial migration file, such as incorrect naming or location.
encore run again.** Error: could not connect to the database **
When you can't connect to the database in your local environment, there's likely an issue with Docker:
encore run again.encore daemon, then try encore run again.** Error: Creating PostgreSQL database cluster Failed **
This means Encore was not able to create the database. Often this is due to a problem with Docker.
docker images.sudo usermod -aG docker $USER (Learn more in the Docker documentation)** Error: unable to save docker image **
This error is often caused by a problem with Docker.
Allow the default Docker socket to be used is checked.encore daemon, then try encore run again.** Error: unable to add CA to cert pool **
This error is commonly caused by the presence of the file $HOME/.postgresql/root.crt on the filesystem.
When this file is present the PostgreSQL client library will assume the database server has that root certificate,
which will cause the above error.
encore run again.** Resetting databases **
If your local database is in a bad state (e.g. due to a incomplete migration or corrupt data), you can reset it by running:
$ encore db reset <database-name>
This drops and recreates the database, re-running all migrations from scratch. Use --all to reset all databases at once.