github.com/drud/ddev@v1.21.5-alpha1.0.20230226034409-94fcc4b94453/docs/content/users/extend/database-types.md (about)

     1  # Database Server Types
     2  
     3  DDEV supports most versions of MariaDB, MySQL, and PostgreSQL database servers.
     4  
     5  The default database type is MariaDB, and the default version is currently 10.4, but you can use nearly any MariaDB versions 5.5-10.8, MySQL 5.5-8.0, and Postgres 9-15.
     6  
     7  You could set these using the [`ddev config`](../usage/commands.md#config) command like this:
     8  
     9  - `ddev config --database=mysql:5.7`
    10  - `ddev config --database=mariadb:10.6`
    11  - `ddev config --database=postgres:14`.
    12  
    13  Or by editing the [`database`](../configuration/config.md#database) setting in `.ddev/config.yaml`:
    14  
    15  ```yaml
    16  database:
    17    type: mysql
    18    version: 5.7
    19  ```
    20  
    21  ```yaml
    22  database:
    23    type: mariadb
    24    version: 10.6
    25  ```
    26  
    27  ```yaml
    28  database:
    29    type: postgres
    30    version: 14
    31  ```
    32  
    33  ## Checking the Existing Database and/or Migrating
    34  
    35  Since the existing binary database may not be compatible with changes to your configuration, you need to check and/or migrate your database.
    36  
    37  - [`ddev debug get-volume-db-version`](../usage/commands.md#debug-get-volume-db-version) will show the current binary database type.
    38  - [`ddev debug check-db-match`](../usage/commands.md#debug-check-db-match) will show if your configured project matches the binary database type.
    39  - [`ddev debug migrate-database`](../usage/commands.md#debug-migrate-database) allows an automated attempt at migrating your database to a different type/version.
    40      - This only works with databases of type `mysql` or `mariadb`.
    41      - 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 migrated *from* databases of type `mysql:8.0` because dumps from MySQL 8.0 often have keywords or other features not supported elsewhere.
    42      - Examples: `ddev debug migrate-database mariadb:10.7`, `ddev debug migrate-database mysql:8.0`.
    43  
    44  ## Caveats
    45  
    46  - 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.
    47  - 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.
    48  - 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.