You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2021/01/17 10:47:39 UTC
[shardingsphere] branch master updated: Resolve problem for utf8
chars cannot encoding with IT (#9063)
This is an automated email from the ASF dual-hosted git repository.
panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new b173636 Resolve problem for utf8 chars cannot encoding with IT (#9063)
b173636 is described below
commit b1736368cab15c7de7b5694635fe1afa9c55546e
Author: Liang Zhang <te...@163.com>
AuthorDate: Sun Jan 17 18:47:06 2021 +0800
Resolve problem for utf8 chars cannot encoding with IT (#9063)
* Resolve problem for utf8 chars cannot encoding
* Resolve problem for utf8 chars cannot encoding
* Resolve problem for utf8 chars cannot encoding
---
.../env/datasource/DatabaseEnvironment.java | 4 +--
.../resources/docker/db/proxy/conf/config-db.yaml | 20 +++++------
.../conf/config-dbtbl-with-replica-query.yaml | 40 +++++++++++-----------
.../proxy/conf/config-replica-query.yaml | 6 ++--
.../docker/tbl/proxy/conf/config-tbl.yaml | 2 +-
.../src/test/resources/env/db/mysql/init.sql | 3 ++
.../env/dbtbl_with_replica_query/mysql/init.sql | 3 ++
.../resources/env/replica_query/mysql/init.sql | 3 ++
.../src/test/resources/env/tbl/mysql/init.sql | 3 ++
9 files changed, 48 insertions(+), 36 deletions(-)
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/datasource/DatabaseEnvironment.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/datasource/DatabaseEnvironment.java
index ffb9cdf..670323c 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/datasource/DatabaseEnvironment.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/datasource/DatabaseEnvironment.java
@@ -71,7 +71,7 @@ public final class DatabaseEnvironment {
case "H2":
return "jdbc:h2:mem:test_db;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL";
case "MySQL":
- return String.format("jdbc:mysql://%s:%s?serverTimezone=UTC&useSSL=false&useLocalSessionState=true", host, port);
+ return String.format("jdbc:mysql://%s:%s?serverTimezone=UTC&useSSL=false&useLocalSessionState=true&characterEncoding=utf-8", host, port);
case "PostgreSQL":
return String.format("jdbc:postgresql://%s:%s/", host, port);
case "SQLServer":
@@ -94,7 +94,7 @@ public final class DatabaseEnvironment {
case "H2":
return String.format("jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL", dataSourceName);
case "MySQL":
- return String.format("jdbc:mysql://%s:%s/%s?serverTimezone=UTC&useSSL=false&useLocalSessionState=true", host, port, dataSourceName);
+ return String.format("jdbc:mysql://%s:%s/%s?serverTimezone=UTC&useSSL=false&useLocalSessionState=true&characterEncoding=utf-8", host, port, dataSourceName);
case "PostgreSQL":
return String.format("jdbc:postgresql://%s:%s/%s", host, port, dataSourceName);
case "SQLServer":
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/db/proxy/conf/config-db.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/db/proxy/conf/config-db.yaml
index 7d9ba2c..6b0c0bb 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/db/proxy/conf/config-db.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/db/proxy/conf/config-db.yaml
@@ -19,7 +19,7 @@ schemaName: db
dataSources:
ds_0:
- url: jdbc:mysql://mysql.db.host:3306/db_0?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.db.host:3306/db_0?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -29,7 +29,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
ds_1:
- url: jdbc:mysql://mysql.db.host:3306/db_1?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.db.host:3306/db_1?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -39,7 +39,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
ds_2:
- url: jdbc:mysql://mysql.db.host:3306/db_2?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.db.host:3306/db_2?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -49,7 +49,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
ds_3:
- url: jdbc:mysql://mysql.db.host:3306/db_3?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.db.host:3306/db_3?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -59,7 +59,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
ds_4:
- url: jdbc:mysql://mysql.db.host:3306/db_4?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.db.host:3306/db_4?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -69,7 +69,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
ds_5:
- url: jdbc:mysql://mysql.db.host:3306/db_5?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.db.host:3306/db_5?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -79,7 +79,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
ds_6:
- url: jdbc:mysql://mysql.db.host:3306/db_6?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.db.host:3306/db_6?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -89,7 +89,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
ds_7:
- url: jdbc:mysql://mysql.db.host:3306/db_7?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.db.host:3306/db_7?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -99,7 +99,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
ds_8:
- url: jdbc:mysql://mysql.db.host:3306/db_8?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.db.host:3306/db_8?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -109,7 +109,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
ds_9:
- url: jdbc:mysql://mysql.db.host:3306/db_9?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.db.host:3306/db_9?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_replica_query/proxy/conf/config-dbtbl-with-replica-query.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_replica_query/proxy/conf/config-dbtbl-with-replica-query.yaml
index 55d7a41..ba56d3d 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_replica_query/proxy/conf/config-dbtbl-with-replica-query.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/dbtbl_with_replica_query/proxy/conf/config-dbtbl-with-replica-query.yaml
@@ -19,7 +19,7 @@ schemaName: dbtbl_with_replica_query
dataSources:
primary_ds_0:
- url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/primary_ds_0?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/primary_ds_0?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -29,7 +29,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
primary_ds_1:
- url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/primary_ds_1?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/primary_ds_1?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -39,7 +39,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
primary_ds_2:
- url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/primary_ds_2?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/primary_ds_2?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -49,7 +49,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
primary_ds_3:
- url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/primary_ds_3?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/primary_ds_3?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -59,7 +59,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
primary_ds_4:
- url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/primary_ds_4?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/primary_ds_4?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -69,7 +69,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
primary_ds_5:
- url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/primary_ds_5?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/primary_ds_5?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -79,7 +79,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
primary_ds_6:
- url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/primary_ds_6?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/primary_ds_6?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -89,7 +89,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
primary_ds_7:
- url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/primary_ds_7?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/primary_ds_7?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -99,7 +99,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
primary_ds_8:
- url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/primary_ds_8?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/primary_ds_8?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -109,7 +109,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
primary_ds_9:
- url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/primary_ds_8?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/primary_ds_8?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -119,7 +119,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
replica_ds_0:
- url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/replica_ds_0?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/replica_ds_0?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -129,7 +129,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
replica_ds_1:
- url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/replica_ds_1?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/replica_ds_1?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -139,7 +139,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
replica_ds_2:
- url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/replica_ds_2?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/replica_ds_2?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -149,7 +149,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
replica_ds_3:
- url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/replica_ds_3?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/replica_ds_3?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -159,7 +159,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
replica_ds_4:
- url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/replica_ds_4?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/replica_ds_4?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -169,7 +169,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
replica_ds_5:
- url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/replica_ds_5?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/replica_ds_5?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -179,7 +179,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
replica_ds_6:
- url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/replica_ds_6?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/replica_ds_6?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -189,7 +189,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
replica_ds_7:
- url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/replica_ds_7?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/replica_ds_7?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -199,7 +199,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
replica_ds_8:
- url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/replica_ds_8?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/replica_ds_8?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -209,7 +209,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
replica_ds_9:
- url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/replica_ds_8?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.dbtbl-with-replica-query.host:3306/replica_ds_8?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/replica_query/proxy/conf/config-replica-query.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/replica_query/proxy/conf/config-replica-query.yaml
index a24ec59..0950d5f 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/replica_query/proxy/conf/config-replica-query.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/replica_query/proxy/conf/config-replica-query.yaml
@@ -19,7 +19,7 @@ schemaName: replica_query
dataSources:
primary_ds:
- url: jdbc:mysql://mysql.replica-query.host:3306/primary_ds?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.replica-query.host:3306/primary_ds?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -29,7 +29,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
replica_0:
- url: jdbc:mysql://mysql.replica-query.host:3306/replica_0?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.replica-query.host:3306/replica_0?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
@@ -39,7 +39,7 @@ dataSources:
minPoolSize: 2
maintenanceIntervalMilliseconds: 30000
replica_1:
- url: jdbc:mysql://mysql.replica-query.host:3306/replica_1?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.replica-query.host:3306/replica_1?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/tbl/proxy/conf/config-tbl.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/tbl/proxy/conf/config-tbl.yaml
index ed8a7fa..566d2e5 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/tbl/proxy/conf/config-tbl.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/tbl/proxy/conf/config-tbl.yaml
@@ -19,7 +19,7 @@ schemaName: tbl
dataSources:
tbl:
- url: jdbc:mysql://mysql.tbl.host:3306/tbl?serverTimezone=UTC&useSSL=false
+ url: jdbc:mysql://mysql.tbl.host:3306/tbl?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
connectionTimeoutMilliseconds: 30000
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/db/mysql/init.sql b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/db/mysql/init.sql
index 85f39d6..989ea86 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/db/mysql/init.sql
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/db/mysql/init.sql
@@ -18,6 +18,9 @@
CREATE USER IF NOT EXISTS 'root'@'%' IDENTIFIED BY '';
GRANT All privileges ON *.* TO 'root'@'%';
+SET character_set_database='utf8';
+SET character_set_server='utf8';
+
DROP DATABASE IF EXISTS db_0;
DROP DATABASE IF EXISTS db_1;
DROP DATABASE IF EXISTS db_2;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_replica_query/mysql/init.sql b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_replica_query/mysql/init.sql
index 0063632..14ae2ba 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_replica_query/mysql/init.sql
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_replica_query/mysql/init.sql
@@ -18,6 +18,9 @@
CREATE USER IF NOT EXISTS 'root'@'%' IDENTIFIED BY '';
GRANT All privileges ON *.* TO 'root'@'%';
+SET character_set_database='utf8';
+SET character_set_server='utf8';
+
DROP DATABASE IF EXISTS primary_ds_0;
DROP DATABASE IF EXISTS primary_ds_1;
DROP DATABASE IF EXISTS primary_ds_2;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/replica_query/mysql/init.sql b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/replica_query/mysql/init.sql
index 11ae2d4..596490e 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/replica_query/mysql/init.sql
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/replica_query/mysql/init.sql
@@ -18,6 +18,9 @@
CREATE USER IF NOT EXISTS 'root'@'%' IDENTIFIED BY '';
GRANT All privileges ON *.* TO 'root'@'%';
+SET character_set_database='utf8';
+SET character_set_server='utf8';
+
DROP DATABASE IF EXISTS primary_ds;
DROP DATABASE IF EXISTS replica_0;
DROP DATABASE IF EXISTS replica_1;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/tbl/mysql/init.sql b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/tbl/mysql/init.sql
index 1bc416c..86c04c8 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/tbl/mysql/init.sql
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/tbl/mysql/init.sql
@@ -18,6 +18,9 @@
CREATE USER IF NOT EXISTS 'root'@'%' IDENTIFIED BY '';
GRANT All privileges ON *.* TO 'root'@'%';
+SET character_set_database='utf8';
+SET character_set_server='utf8';
+
DROP DATABASE IF EXISTS tbl;
CREATE DATABASE tbl;