DDVEV: Change database server version
The easy way
- change database version in DDEV configuration, restart;
- If errors ("Unable to start project because the configured database type does not match the current actual database"), go for the hard way.
The hard way
- backup yourself any databases you want to keep, DDEV will destroy all;
ddev start
(do not change configuration by hand);
ddev debug migrate-database mariadb:10.8
- DDEV will promise to import back the databases however:
- it will only handle the
db
database, any custom databases will only be destroyed;
- even for the
db
the import will sometimes fail;
The current way
# Display databses
ddev mariadb
SHOW DATABASES;
# Export database(s)
DB_DATE=`date '+%y%m%d'`;
DB_NAME='db';
ddev export-db --database=$DB_NAME --file=var/tmp/$DB_NAME.$DB_DATE.sql.gz
# Delete ddev project
ddev delete --omit-snapshot
# Set new version in .ddev/config.yaml
# Restart
ddev restart
# Import databse(s)
ddev import-db --database=$DB_NAME --file=var/tmp/$DB_NAME.$DB_DATE.sql.gz
# Show the current binary database type.
ddev debug get-volume-db-version
# Check if your configured project matches the binary database type
ddev debug check-db-match
# Cleanup
rm -f var/tmp/$DB_NAME.$DB_DATE.sql.gz
Other solutions
External resources