github.com/ddev/ddev@v1.23.2-0.20240519125000-d824ffe36ff3/docs/content/users/extend/database-types.md (about)

     1  # Database Server Types
     2  
     3  DDEV supports many versions of the MariaDB, MySQL, and PostgreSQL database servers.
     4  
     5  The following database types are currently supported:
     6  
     7  - MariaDB 5.5-10.8 and 10.11
     8  - MySQL 5.5-8.0
     9  - Postgres 9-16
    10  
    11  The default database type is MariaDB, and the default version is currently 10.11.
    12  New LTS versions of each of these are typically added soon after they are released. The very old versions are kept for compatibility with older projects.
    13  
    14  You could set these using the [`ddev config`](../usage/commands.md#config) command like this:
    15  
    16  - `ddev config --database=mysql:5.7`
    17  - `ddev config --database=mariadb:10.11`
    18  - `ddev config --database=postgres:14`
    19  
    20  Or by editing the [`database`](../configuration/config.md#database) setting in `.ddev/config.yaml`:
    21  
    22  ```yaml
    23  database:
    24    type: mysql
    25    version: 5.7
    26  ```
    27  
    28  ```yaml
    29  database:
    30    type: mariadb
    31    version: 10.11
    32  ```
    33  
    34  ```yaml
    35  database:
    36    type: postgres
    37    version: 14
    38  ```
    39  
    40  ## Checking the Existing Database and/or Migrating
    41  
    42  Since the existing binary database may not be compatible with changes to your configuration, you need to check and/or migrate your database.
    43  
    44  - [`ddev debug get-volume-db-version`](../usage/commands.md#debug-get-volume-db-version) will show the current binary database type.
    45  - [`ddev debug check-db-match`](../usage/commands.md#debug-check-db-match) will show if your configured project matches the binary database type.
    46  - [`ddev debug migrate-database`](../usage/commands.md#debug-migrate-database) allows an automated attempt at migrating your database to a different type/version.
    47      - This only works with databases of type `mysql` or `mariadb`.
    48      - MySQL 8.0 has diverged in syntax from most of its predecessors, including earlier MySQL and all MariaDB versions. As a result, you may not be able to migrate *from* databases of type `mysql:8.0` because dumps from MySQL 8.0 often have keywords or other features not supported elsewhere.
    49      - Examples: `ddev debug migrate-database mariadb:10.7`, `ddev debug migrate-database mysql:8.0`.
    50  
    51  ## Caveats
    52  
    53  - If you change the database type or version in an existing project, the existing database will not be compatible with your change, so you’ll want to use [`ddev export-db`](../usage/commands.md#export-db) to save a dump first.
    54  - When you change database type, destroy the existing database using [`ddev delete --omit-snapshot`](../usage/commands.md#delete) before changing, then after [`ddev start`](../usage/commands.md#start) use [`ddev import-db`](../usage/commands.md#import-db) to import the dump you saved.
    55  - Snapshots are always per database type and database version. So if you have snapshots from MariaDB 10.2 and you switch to MariaDB 10.5, don’t expect to be able to restore the old snapshot.
    56  
    57  ## Other databases types
    58  
    59  Through add-ons, additional database types are also supported.
    60  The following official add-ons are available:
    61  
    62  - [`ddev/ddev-mongo`](https://github.com/ddev/ddev-mongo)
    63  - [`ddev/ddev-sqlsrv`](https://github.com/ddev/ddev-sqlsrv)
    64  
    65  Use `ddev get --list --all` to see a list of all add-ons, including additional community-supported database types.