> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/tposs/6.15/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/tposs/6.15/configuration/db.md).

# Database client settings

TPOSS must have the ability to connect to the MySQL service from the start-up. The main TPOSS configuration related to the database connection is as follows:

```yaml
database:
  # Database name used by TPOSS
  name: tposs
  # Database client user name
  user: tposs
  # Database client user password
  password: tposs
  # Host address of the database server
  host: db-host
  # Database client username
  user: db-user
  # Database client password
  password: db-password
  # Specifies if TLS is used to connect to the database server.
  ssl: false
  # TLS version to connect to the database server. The possible values are: tlsv2, tlsv1, tlsv1.3.
  ssl_versions: tlsv2
  # Number of connections within the database connection pool
  connections: 50
  # Timeout in milliseconds to wait for a free connection from the database connection pool
  queue_target: 50
  # Size of the TCP buffer used by client sockets
  recbuf: 87380
  # Time in milliseconds to wait for the query call to finish
  timeout: 30000
  # The values configure the upper limits for round trip time intervals of database queries.
  # The limits are translated into Prometheus histogram buckets. The values are provided in milliseconds.
  query_histogram_buckets: "5, 20, 50, 100, 250, 500, 1000"
  # The values configure the upper limits of time intervals that queries spent in the queue.
  # The limits are translated into Prometheus histogram buckets. The values are provided in milliseconds.
  queue_histogram_buckets: "1, 5, 20, 50, 100, 250, 500"
```

For more information about the values for the **query_histogram_buckets** and **queue_histogram_buckets** options, see the [Prometheus histograms](https://prometheus.io/docs/practices/histograms/).

In addition, new versions of TPOSS may need database migrations. To run a database migration on start-up, enable this option:

```yaml
# Run the database migration during TPOSS startup
tposs_migrate_db_on_start: true
```

TPOSS may store PCS sessions in different databases. The supported databases are:

- MySQL
- Mnesia

>**NOTE:** The MySQL database is preferred for the TPOSS [high availability use-case](https://docs.cennso.com/components/tposs/6.15/use-cases/availability-cases/tposs-ha.md) as it leads to much easier and stable upgrades.

To configure the backend for the PCS sessions, use this configuration option:

```yaml
sessions:
  # Type of the backend storage for PCS sessions
  backend: mysql
```
