---
title: "Configuration"
manual: "TYPO3 Explained"
version: "11.5"
permalink: "https://docs.typo3.org/permalink/t3coreapi:database-configuration@11.5"
source: "ApiOverview/Database/Configuration/Index.rst"
rendered: "2026-10-21T15:30:00+00:00"
---

> [!WARNING]
> **Attention**
>
> TYPO3 v11 has reached end-of-life as of October 31th 2024 and
> is no longer being maintained. Use the version switcher on the top
> left of this page to select documentation for a supported version of TYPO3.
>
> Need more time before upgrading?
> You can purchase Extended Long Term Support (ELTS) for TYPO3 v11 here:
> [TYPO3 ELTS](https://typo3.com/services/extended-support-elts).

# Configuration {#database-configuration}

The configuration of Doctrine DBAL for TYPO3 is about specifying the single
database endpoints and passing the connection credentials. The framework
supports the parallel usage of multiple database connections, a specific
connection is mapped depending on its table name. The table space can be seen as
a transparent layer that determines which specific connection is chosen for a
query to a single or a group of tables: It allows "swapping out" single tables
from the `Default` connection to point them to a different database endpoint.

As with other central configuration options, the database endpoint and mapping
configuration is done in `typo3conf/LocalConfiguration.php` and ends up in
`$GLOBALS['TYPO3_CONF_VARS']` after the Core [bootstrap](https://docs.typo3.org/permalink/t3coreapi:bootstrapping@11.5). The specific sub-array is
`$GLOBALS['TYPO3_CONF_VARS']['DB']`.

## Example: one connection {#example-one-connection}

A typical basic example using only the `Default` connection with a single
database endpoint:

**typo3conf/LocalConfiguration.php**

```php
// [...]
'DB' => [
    'Connections' => [
        'Default' => [
            'charset' => 'utf8',
            'dbname' => 'theDatabaseName',
            'driver' => 'mysqli',
            'host' => 'theHost',
            'password' => 'theConnectionPassword',
            'port' => 3306,
            'user' => 'theUser',
        ],
    ],
],
// [...]
```

Remarks:

-   The `Default` connection must be configured, this can not be left out or
    renamed.
-   For the `mysqli` driver: If the `host` is set to `localhost`
    and if the default PHP options in this area are not changed, the connection
    will be socket-based. This saves a little overhead. To force a TCP/IP-based
    connection even for `localhost`, the IPv4 address `127.0.0.1` or IPv6
    address `::1/128` respectively must be used as `host` value.
-   The connection options are passed to Doctrine DBAL without much
    manipulation from TYPO3 side. Please refer to the
    [doctrine connection docs](https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html) for a full overview of the settings.
-   If the `charset` option is not specified, it defaults to `utf8`.
-   The option `wrapperClass` is used by TYPO3 to insert the extended
    [Connection](https://docs.typo3.org/permalink/t3coreapi:database-connection@11.5) class
    `\TYPO3\CMS\Core\Database\Connection` as main facade around Doctrine DBAL.

## Example: two connections {#example-two-connections}

Another example with two connections, where the `be_sessions` table is
mapped to a different endpoint:

**typo3conf/LocalConfiguration.php**

```php
// [...]
'DB' => [
    'Connections' => [
        'Default' => [
            'charset' => 'utf8',
            'dbname' => 'default_dbname',
            'driver' => 'mysqli',
            'host' => 'default_host',
            'password' => '***',
            'port' => 3306,
            'user' => 'default_user',
        ],
        'Sessions' => [
            'charset' => 'utf8mb4',
            'driver' => 'mysqli',
            'dbname' => 'sessions_dbname',
            'host' => 'sessions_host',
            'password' => '***',
            'port' => 3306,
            'user' => 'some_user',
        ],
    ],
    'TableMapping' => [
        'be_sessions' => 'Sessions',
    ]
],
// [...]
```

Remarks:

-   The array key `Sessions` is just a name. It can be different, but it is
    good practice to give it a useful, descriptive name.
-   It is possible to map multiple tables to a different endpoint by adding
    further table name / connection name pairs to `TableMapping`.
-   However, this "connection per table" approach is limited: In the above
    example, if a join query is executed that spans different connections, an
    exception will be thrown. It is up to the administrator to group the
    affected tables to the same connection in those cases, or a developer should
    implement fallback logic to suppress the `join()`.

> [!WARNING]
> **Attention**
>
> Connections to MariaDB, MySQL, PostgreSQL and SQLiteare actively tested.
> However, SQL Server is currently not actively tested.
>
> The TYPO3 installer supports only a single MariaDB or MySQL connection at
> the moment.

> [!NOTE]
> **See also**
>
> [Overview of all DB configuration options](https://docs.typo3.org/permalink/t3coreapi:typo3confvars-db-connections@11.5)
