diff --git a/containers/ddev-dbserver/files/docker-entrypoint.sh b/containers/ddev-dbserver/files/docker-entrypoint.sh index 99f34e92592..9a4a3600cae 100755 --- a/containers/ddev-dbserver/files/docker-entrypoint.sh +++ b/containers/ddev-dbserver/files/docker-entrypoint.sh @@ -74,7 +74,9 @@ rm -f /tmp/raw_mysql_version.txt # If we have extra mariadb cnf files, copy them to where they go. if [ -d /mnt/ddev_config/mysql ] && [ "$(echo /mnt/ddev_config/mysql/*.cnf)" != "/mnt/ddev_config/mysql/*.cnf" ] ; then - echo "!includedir /mnt/ddev_config/mysql" >/etc/mysql/conf.d/ddev.cnf + cp /mnt/ddev_config/mysql/*.cnf /etc/mysql/conf.d + # Ignore errors on files such as .gitmanaged + chmod -f -R ugo-w /etc/mysql/conf.d/* fi diff --git a/pkg/ddevapp/ddevapp_test.go b/pkg/ddevapp/ddevapp_test.go index 93e53ca5b8c..1c98e384fd7 100644 --- a/pkg/ddevapp/ddevapp_test.go +++ b/pkg/ddevapp/ddevapp_test.go @@ -1801,6 +1801,32 @@ func TestDdevAllDatabases(t *testing.T) { assert.Equal(dbType+"_"+dbVersion, strings.Trim(containerDBVersion, "\n\r ")) } + if dbType == nodeps.MariaDB || dbType == nodeps.MySQL { + // Make sure overriding configuration works + out, stderr, err := app.Exec(&ddevapp.ExecOpts{ + Service: "db", + Cmd: `mysql -sN -e "SELECT @@global.time_zone"`, + }) + assert.NoError(err) + assert.Equal("SYSTEM\n", out, "out: %s, stderr: %s", out, stderr) + + err = os.MkdirAll(app.GetConfigPath("mysql"), 0750) + require.NoError(t, err) + err = os.WriteFile(app.GetConfigPath("mysql/override_param_test.cnf"), []byte("[mysqld]\n default-time-zone = \"+08:00\""), 0666) + require.NoError(t, err) + err = app.Restart() + require.NoError(t, err) + out, stderr, err = app.Exec(&ddevapp.ExecOpts{ + Service: "db", + Cmd: `mysql -sN -e "SELECT @@global.time_zone"`, + }) + assert.NoError(err) + assert.Equal("+08:00\n", out, "out: %s, stderr: %s", out, stderr) + // Delete override file for next dbType test + err = os.Remove(app.GetConfigPath("mysql/override_param_test.cnf")) + require.NoError(t, err) + } + c = map[string]string{ nodeps.MySQL: `echo "SELECT COUNT(*) FROM users;" | mysql -N`, nodeps.MariaDB: `echo "SELECT COUNT(*) FROM users;" | mysql -N`, diff --git a/pkg/versionconstants/versionconstants.go b/pkg/versionconstants/versionconstants.go index 80a2c42e5f6..0e898aad89b 100644 --- a/pkg/versionconstants/versionconstants.go +++ b/pkg/versionconstants/versionconstants.go @@ -21,7 +21,7 @@ var WebTag = "20230720_ted933_doc_installation_ubuntu_apt_vulnerability" // Note var DBImg = "ddev/ddev-dbserver" // BaseDBTag is the main tag, DBTag is constructed from it -var BaseDBTag = "v1.22.0" +var BaseDBTag = "20230806_mysql_config_windows" const TraditionalRouterImage = "ddev/ddev-nginx-proxy-router:20230816_traefik_image" const TraefikRouterImage = "ddev/ddev-traefik-router:20230816_traefik_image"