From 142a0aff6567d9b2405976b78837792294676e19 Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Thu, 12 Nov 2020 14:55:22 +0100 Subject: [PATCH] auth mysql: disable automatic charset detection --- .github/actions/spell-check/expect.txt | 1 + docs/upgrading.rst | 20 +++++++++++++++++++ modules/gmysqlbackend/smysql.cc | 4 ---- .../tests/8bit-txt-unescaped/skip.gmysql | 0 4 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 regression-tests/tests/8bit-txt-unescaped/skip.gmysql diff --git a/.github/actions/spell-check/expect.txt b/.github/actions/spell-check/expect.txt index 9d0bcaeab0..210546d263 100644 --- a/.github/actions/spell-check/expect.txt +++ b/.github/actions/spell-check/expect.txt @@ -114,6 +114,7 @@ autocomplete autoconf autodetect autodetecting +autodetection autodoc autofilling autogenerated diff --git a/docs/upgrading.rst b/docs/upgrading.rst index 9d2e66569c..30113df9b3 100644 --- a/docs/upgrading.rst +++ b/docs/upgrading.rst @@ -11,6 +11,26 @@ upgrade notes if your version is older than 3.4.2. 4.3.x to 4.4.0 -------------- +MySQL character set detection +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Before 4.4.0, the gmysql backend told the MySQL (or MariaDB) client libraries to automatically detect the client character set and collation, based on the environment locale. +(Look for 'autodetect' in https://dev.mysql.com/doc/refman/5.7/en/charset-connection.html to know more). +On some systems, this autodetection makes choices that are incompatible with MySQL Server 8 defaults. +On all systems, this autodetection can make choices that vary depending on how PowerDNS is started. +In other words, the autodetection provides unpredictable results. + +In 4.4.0, the autodetection has been removed. +The MySQL/MariaDB client lib will now use its default settings, unless overridden in ``my.cnf``, for example:: + + [client] + default-character-set = latin1 + +If you have trouble connecting to your database with 4.4.0 or up, you can override the character set in ``my.cnf``. + +Before upgrading, please check your database for any non-ASCII content. +The interpretation of the non-ASCII bytes in those fields might change because of a different charset suddenly being used. + Record type changes on secondaries ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/modules/gmysqlbackend/smysql.cc b/modules/gmysqlbackend/smysql.cc index d5e8199529..501c4432c6 100644 --- a/modules/gmysqlbackend/smysql.cc +++ b/modules/gmysqlbackend/smysql.cc @@ -465,10 +465,6 @@ void SMySQL::connect() } #endif -#if MYSQL_VERSION_ID >= 50500 - mysql_options(&d_db, MYSQL_SET_CHARSET_NAME, MYSQL_AUTODETECT_CHARSET_NAME); -#endif - if (d_setIsolation && (retry == 1)) mysql_options(&d_db, MYSQL_INIT_COMMAND,"SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED"); diff --git a/regression-tests/tests/8bit-txt-unescaped/skip.gmysql b/regression-tests/tests/8bit-txt-unescaped/skip.gmysql new file mode 100644 index 0000000000..e69de29bb2 -- 2.47.2