diff --git a/extensions/mysql-metadata-storage/src/main/java/io/druid/metadata/storage/mysql/MySQLConnector.java b/extensions/mysql-metadata-storage/src/main/java/io/druid/metadata/storage/mysql/MySQLConnector.java index d7fa235082d..a0f90c7db6c 100644 --- a/extensions/mysql-metadata-storage/src/main/java/io/druid/metadata/storage/mysql/MySQLConnector.java +++ b/extensions/mysql-metadata-storage/src/main/java/io/druid/metadata/storage/mysql/MySQLConnector.java @@ -30,6 +30,7 @@ import org.apache.commons.dbcp2.BasicDataSource; import org.skife.jdbi.v2.DBI; import org.skife.jdbi.v2.Handle; import org.skife.jdbi.v2.tweak.HandleCallback; +import org.skife.jdbi.v2.util.BooleanMapper; import java.sql.SQLException; @@ -77,16 +78,14 @@ public class MySQLConnector extends SQLMetadataConnector { // ensure database defaults to utf8, otherwise bail boolean isUtf8 = handle - .createQuery("SHOW VARIABLES where variable_name = 'character_set_database' and value = 'utf8'") - .list() - .size() == 1; + .createQuery("SELECT @@character_set_database = 'utf8'") + .map(BooleanMapper.FIRST) + .first(); if (!isUtf8) { throw new ISE( "Database default character set is not UTF-8." + System.lineSeparator() + " Druid requires its MySQL database to be created using UTF-8 as default character set." - + " If you are upgrading from Druid 0.6.x, please make all tables have been converted to utf8 and change the database default." - + " For more information on how to convert and set the default, please refer to section on updating from 0.6.x in the Druid 0.7.1 release notes." ); }