You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/07/15 07:16:29 UTC

[shardingsphere] branch master updated: Scaling IT use accounts with restricted privileges (#19124)

This is an automated email from the ASF dual-hosted git repository.

zhonghongsheng 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 265e01af583 Scaling IT use accounts with restricted privileges (#19124)
265e01af583 is described below

commit 265e01af583572d76b4e371770b94a1b1562b4fe
Author: azexcy <10...@users.noreply.github.com>
AuthorDate: Fri Jul 15 15:16:22 2022 +0800

    Scaling IT use accounts with restricted privileges (#19124)
---
 .github/workflows/it-scaling.yml                   |  2 +-
 .../data/pipeline/cases/base/BaseITCase.java       | 70 ++++++++--------------
 .../data/pipeline/cases/entity/JdbcInfoEntity.java | 32 ----------
 .../cases/general/MySQLGeneralScalingIT.java       |  6 +-
 .../cases/general/PostgreSQLGeneralScalingIT.java  |  5 +-
 .../cases/primarykey/TextPrimaryKeyScalingIT.java  |  1 +
 .../pipeline/cases/task/MySQLIncrementTask.java    |  4 +-
 .../cases/task/PostgreSQLIncrementTask.java        |  4 +-
 .../pipeline/env/IntegrationTestEnvironment.java   | 47 +++------------
 .../container/compose/BaseComposedContainer.java   |  7 +++
 .../container/compose/DockerComposedContainer.java |  4 ++
 .../container/compose/NativeComposedContainer.java | 69 ++++++++++++++++++++-
 .../container/database/MySQLContainer.java         |  9 +--
 .../container/database/OpenGaussContainer.java     |  5 +-
 .../container/database/PostgreSQLContainer.java    | 11 ++--
 .../proxy/ShardingSphereProxyDockerContainer.java  |  6 --
 .../src/test/resources/env/it-env.properties       | 10 ++--
 .../src/test/resources/env/mysql/initdb.sql        | 10 +++-
 .../resources/env/{mysql => postgresql}/initdb.sql | 16 ++++-
 .../scenario/primarykey/text_primary_key/mysql.xml |  2 +-
 20 files changed, 169 insertions(+), 151 deletions(-)

diff --git a/.github/workflows/it-scaling.yml b/.github/workflows/it-scaling.yml
index bc74491105f..4972fa17927 100644
--- a/.github/workflows/it-scaling.yml
+++ b/.github/workflows/it-scaling.yml
@@ -60,7 +60,7 @@ concurrency:
   cancel-in-progress: true
 
 env:
-  MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.javadoc.skip=true -Drat.skip=true -Dcheckstyle.skip=true -Dspotless.apply.skip=true -Djacoco.skip=true -Dfailsafe.skipAfterFailureCount=1
+  MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.javadoc.skip=true -Drat.skip=true -Dcheckstyle.skip=true -Dspotless.apply.skip=true -Djacoco.skip=true -Dfailsafe.skipAfterFailureCount=1 -Dio.netty.leakDetectionLevel=advanced
 
 jobs:
   scaling-it-test:
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java
index 997ed08869a..10d9282249b 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java
@@ -30,7 +30,6 @@ import org.apache.shardingsphere.infra.database.metadata.url.JdbcUrlAppender;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
 import org.apache.shardingsphere.integration.data.pipeline.cases.command.CommonSQLCommand;
-import org.apache.shardingsphere.integration.data.pipeline.cases.entity.JdbcInfoEntity;
 import org.apache.shardingsphere.integration.data.pipeline.env.IntegrationTestEnvironment;
 import org.apache.shardingsphere.integration.data.pipeline.env.enums.ScalingITEnvTypeEnum;
 import org.apache.shardingsphere.integration.data.pipeline.framework.container.compose.BaseComposedContainer;
@@ -99,6 +98,10 @@ public abstract class BaseITCase {
     
     private final DatabaseType databaseType;
     
+    private final String username;
+    
+    private final String password;
+    
     private JdbcTemplate jdbcTemplate;
     
     @Setter
@@ -112,42 +115,25 @@ public abstract class BaseITCase {
             composedContainer = new NativeComposedContainer(parameterized.getDatabaseType());
         }
         composedContainer.start();
-        initActualDataSources();
-        commonSQLCommand = JAXB.unmarshal(Objects.requireNonNull(BaseITCase.class.getClassLoader().getResource("env/common/command.xml")), CommonSQLCommand.class);
+        if (ENV.getItEnvType() == ScalingITEnvTypeEnum.DOCKER) {
+            DatabaseContainer databaseContainer = ((DockerComposedContainer) composedContainer).getDatabaseContainer();
+            username = databaseContainer.getUsername();
+            password = databaseContainer.getPassword();
+        } else {
+            username = ENV.getActualDataSourceUsername(databaseType);
+            password = ENV.getActualDataSourcePassword(databaseType);
+        }
         createProxyDatabase(parameterized.getDatabaseType());
+        if (ENV.getItEnvType() == ScalingITEnvTypeEnum.NATIVE) {
+            cleanUpDataSource();
+        }
+        commonSQLCommand = JAXB.unmarshal(Objects.requireNonNull(BaseITCase.class.getClassLoader().getResource("env/common/command.xml")), CommonSQLCommand.class);
         scalingWatcher = new ScalingWatcher(composedContainer, jdbcTemplate);
     }
     
-    @SneakyThrows(SQLException.class)
-    private void initActualDataSources() {
-        String jdbcUrl;
-        JdbcInfoEntity jdbcInfo;
-        if (ENV.getItEnvType() == ScalingITEnvTypeEnum.DOCKER) {
-            DockerComposedContainer dockerComposedContainer = (DockerComposedContainer) composedContainer;
-            DatabaseContainer databaseContainer = dockerComposedContainer.getDatabaseContainer();
-            jdbcUrl = databaseContainer.getJdbcUrl("");
-            jdbcInfo = new JdbcInfoEntity(databaseContainer.getUsername(), databaseContainer.getPassword(), databaseContainer.getPort());
-        } else {
-            jdbcInfo = ENV.getActualDatabaseJdbcInfo(getDatabaseType());
-            jdbcUrl = DataSourceEnvironment.getURL(databaseType, "localhost", jdbcInfo.getPort(), DatabaseTypeUtil.isOpenGauss(databaseType) ? "postgres" : "");
-            try (Connection connection = DriverManager.getConnection(jdbcUrl, jdbcInfo.getUsername(), jdbcInfo.getPassword())) {
-                for (String each : Arrays.asList(DS_0, DS_1, DS_2, DS_3, DS_4)) {
-                    try {
-                        connection.createStatement().execute(String.format("DROP DATABASE %s", each));
-                    } catch (final SQLException ex) {
-                        log.error("Error occurred when drop database. error msg={}", ex.getMessage());
-                    }
-                }
-            }
-        }
-        try (Connection connection = DriverManager.getConnection(jdbcUrl, jdbcInfo.getUsername(), jdbcInfo.getPassword())) {
-            for (String each : Arrays.asList(DS_0, DS_1, DS_2, DS_3, DS_4)) {
-                try {
-                    connection.createStatement().execute(String.format("CREATE DATABASE %s", each));
-                } catch (final SQLException ex) {
-                    log.error("Error occurred when create database. error msg={}", ex.getMessage());
-                }
-            }
+    private void cleanUpDataSource() {
+        for (String each : Arrays.asList(DS_0, DS_1, DS_2, DS_3, DS_4)) {
+            composedContainer.cleanUpDatabase(each);
         }
     }
     
@@ -220,8 +206,8 @@ public abstract class BaseITCase {
     }
     
     private void addSourceResource0(final Connection connection) throws SQLException {
-        String addSourceResource = commonSQLCommand.getSourceAddResourceTemplate().replace("${user}", ENV.getActualDataSourceUsername(databaseType))
-                .replace("${password}", ENV.getActualDataSourcePassword(databaseType))
+        String addSourceResource = commonSQLCommand.getSourceAddResourceTemplate().replace("${user}", username)
+                .replace("${password}", password)
                 .replace("${ds0}", getActualJdbcUrlTemplate(DS_0))
                 .replace("${ds1}", getActualJdbcUrlTemplate(DS_1));
         executeWithLog(connection, addSourceResource);
@@ -229,8 +215,8 @@ public abstract class BaseITCase {
     
     @SneakyThrows
     protected void addTargetResource() {
-        String addTargetResource = commonSQLCommand.getTargetAddResourceTemplate().replace("${user}", ENV.getActualDataSourceUsername(databaseType))
-                .replace("${password}", ENV.getActualDataSourcePassword(databaseType))
+        String addTargetResource = commonSQLCommand.getTargetAddResourceTemplate().replace("${user}", username)
+                .replace("${password}", password)
                 .replace("${ds2}", getActualJdbcUrlTemplate(DS_2))
                 .replace("${ds3}", getActualJdbcUrlTemplate(DS_3))
                 .replace("${ds4}", getActualJdbcUrlTemplate(DS_4));
@@ -292,7 +278,7 @@ public abstract class BaseITCase {
         ThreadUtil.sleep(1, TimeUnit.SECONDS);
     }
     
-    private void executeWithLog(final String sql, final Integer sleepSeconds) {
+    private void executeWithLog(final String sql, final int sleepSeconds) {
         log.info("jdbcTemplate execute:{}", sql);
         jdbcTemplate.execute(sql);
         ThreadUtil.sleep(Math.max(sleepSeconds, 0), TimeUnit.SECONDS);
@@ -330,7 +316,7 @@ public abstract class BaseITCase {
     }
     
     protected void startScaling(final String jobId) {
-        executeWithLog(String.format("START SCALING %s", jobId));
+        executeWithLog(String.format("START SCALING %s", jobId), 10);
     }
     
     protected void applyScaling(final String jobId) {
@@ -344,9 +330,7 @@ public abstract class BaseITCase {
     }
     
     protected String getScalingJobId() {
-        assertBeforeApplyScalingMetadataCorrectly();
         List<Map<String, Object>> scalingListMap = queryForListWithLog("SHOW SCALING LIST");
-        assertThat(scalingListMap.size(), is(1));
         String jobId = scalingListMap.get(0).get("id").toString();
         log.info("jobId: {}", jobId);
         return jobId;
@@ -359,10 +343,6 @@ public abstract class BaseITCase {
         log.info("jobId: {}", jobId);
         Map<String, String> actualStatusMap = new HashMap<>(2, 1);
         String showScalingStatus = String.format("SHOW SCALING STATUS %s", jobId);
-        SCALING_EXECUTOR.execute(() -> {
-            stopScaling(jobId);
-            startScaling(jobId);
-        });
         for (int i = 0; i < 15; i++) {
             List<Map<String, Object>> showScalingStatusResMap = queryForListWithLog(showScalingStatus);
             log.info("{}: {}", showScalingStatus, showScalingStatusResMap);
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/JdbcInfoEntity.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/JdbcInfoEntity.java
deleted file mode 100644
index ce50cfa3bec..00000000000
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/entity/JdbcInfoEntity.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.integration.data.pipeline.cases.entity;
-
-import lombok.Data;
-import lombok.RequiredArgsConstructor;
-
-@RequiredArgsConstructor
-@Data
-public final class JdbcInfoEntity {
-    
-    private final String username;
-    
-    private final String password;
-    
-    private final int port;
-}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/MySQLGeneralScalingIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/MySQLGeneralScalingIT.java
index 1e6bc86f8d0..e91e0120822 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/MySQLGeneralScalingIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/MySQLGeneralScalingIT.java
@@ -84,10 +84,14 @@ public final class MySQLGeneralScalingIT extends BaseExtraSQLITCase {
             getJdbcTemplate().batchUpdate(getExtraSQLCommand().getFullInsertOrderItem(), dataPair.getRight());
         }
         addTargetResource();
-        startIncrementTask(new MySQLIncrementTask(getJdbcTemplate(), keyGenerateAlgorithm, true));
+        startIncrementTask(new MySQLIncrementTask(getJdbcTemplate(), keyGenerateAlgorithm, true, 20));
         executeWithLog(getCommonSQLCommand().getAlterOrderWithItemAutoTableRule());
         String jobId = getScalingJobId();
         waitScalingFinished(jobId);
+        stopScaling(jobId);
+        // TODO need netty leak fixed
+//        getJdbcTemplate().update("INSERT INTO t_order (id,order_id,user_id,status) VALUES (?, ?, ?, ?)", keyGenerateAlgorithm.generateKey(), 1, 1, "afterStopScaling");
+        startScaling(jobId);
         assertCheckScalingSuccess(jobId);
         applyScaling(jobId);
         assertPreviewTableSuccess("t_order", Arrays.asList("ds_2", "ds_3", "ds_4"));
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/PostgreSQLGeneralScalingIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/PostgreSQLGeneralScalingIT.java
index 811446d0cc5..b3391a33e4b 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/PostgreSQLGeneralScalingIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/PostgreSQLGeneralScalingIT.java
@@ -88,10 +88,13 @@ public final class PostgreSQLGeneralScalingIT extends BaseExtraSQLITCase {
         getJdbcTemplate().batchUpdate(getExtraSQLCommand().getFullInsertOrder(), dataPair.getLeft());
         getJdbcTemplate().batchUpdate(getExtraSQLCommand().getFullInsertOrderItem(), dataPair.getRight());
         addTargetResource();
-        startIncrementTask(new PostgreSQLIncrementTask(getJdbcTemplate(), new SnowflakeKeyGenerateAlgorithm(), "test", true));
+        startIncrementTask(new PostgreSQLIncrementTask(getJdbcTemplate(), new SnowflakeKeyGenerateAlgorithm(), "test", true, 20));
         executeWithLog(getCommonSQLCommand().getAlterOrderWithItemAutoTableRule());
         String jobId = getScalingJobId();
         waitScalingFinished(jobId);
+        stopScaling(jobId);
+        executeWithLog(String.format("INSERT INTO test.t_order (id,order_id,user_id,status) VALUES (%s, %s, %s, '%s')", keyGenerateAlgorithm.generateKey(), 1, 1, "afterStopScaling"));
+        startScaling(jobId);
         assertCheckScalingSuccess(jobId);
         applyScaling(jobId);
         assertPreviewTableSuccess("t_order", Arrays.asList("ds_2", "ds_3", "ds_4"));
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/primarykey/TextPrimaryKeyScalingIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/primarykey/TextPrimaryKeyScalingIT.java
index 0b69ad032a0..f8a12acafab 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/primarykey/TextPrimaryKeyScalingIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/primarykey/TextPrimaryKeyScalingIT.java
@@ -82,6 +82,7 @@ public class TextPrimaryKeyScalingIT extends BaseExtraSQLITCase {
         assertCheckScalingSuccess(jobId);
         applyScaling(jobId);
         assertPreviewTableSuccess("t_order", Arrays.asList("ds_2", "ds_3", "ds_4"));
+        restoreScalingSourceWriting(getScalingJobId());
     }
     
     private void batchInsertOrder() {
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/task/MySQLIncrementTask.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/task/MySQLIncrementTask.java
index b90a26858ea..5229a66eb13 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/task/MySQLIncrementTask.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/task/MySQLIncrementTask.java
@@ -36,10 +36,12 @@ public final class MySQLIncrementTask extends BaseIncrementTask {
     
     private final Boolean incrementOrderItemTogether;
     
+    private final int executeCountLimit;
+    
     @Override
     public void run() {
         int executeCount = 0;
-        while (executeCount < 20 && !Thread.currentThread().isInterrupted()) {
+        while (executeCount < executeCountLimit && !Thread.currentThread().isInterrupted()) {
             Object orderPrimaryKey = insertOrder();
             if (executeCount % 2 == 0) {
                 jdbcTemplate.update("DELETE FROM t_order WHERE id = ?", orderPrimaryKey);
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/task/PostgreSQLIncrementTask.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/task/PostgreSQLIncrementTask.java
index 2b0c671f559..fdd2de3aaae 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/task/PostgreSQLIncrementTask.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/task/PostgreSQLIncrementTask.java
@@ -39,10 +39,12 @@ public final class PostgreSQLIncrementTask extends BaseIncrementTask {
     
     private final boolean incrementOrderItemTogether;
     
+    private final int executeCountLimit;
+    
     @Override
     public void run() {
         int executeCount = 0;
-        while (executeCount < 20 && !Thread.currentThread().isInterrupted()) {
+        while (executeCount < executeCountLimit && !Thread.currentThread().isInterrupted()) {
             Object orderPrimaryKey = insertOrder();
             if (executeCount % 2 == 0) {
                 jdbcTemplate.update(prefixSchema("DELETE FROM ${schema}t_order WHERE id = ?", schema), orderPrimaryKey);
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/IntegrationTestEnvironment.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/IntegrationTestEnvironment.java
index f9a4dfdbd7d..f60024c368d 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/IntegrationTestEnvironment.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/IntegrationTestEnvironment.java
@@ -21,8 +21,6 @@ import lombok.Getter;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
-import org.apache.shardingsphere.integration.data.pipeline.cases.entity.JdbcInfoEntity;
 import org.apache.shardingsphere.integration.data.pipeline.env.enums.ScalingITEnvTypeEnum;
 
 import java.io.IOException;
@@ -76,30 +74,17 @@ public final class IntegrationTestEnvironment {
      * @param databaseType database type.
      * @return jdbc connection
      */
-    public JdbcInfoEntity getActualDatabaseJdbcInfo(final DatabaseType databaseType) {
-        String username;
-        String password;
-        int port;
+    public int getActualDatabasePort(final DatabaseType databaseType) {
         switch (databaseType.getType()) {
             case "MySQL":
-                username = props.getOrDefault("scaling.it.native.mysql.username", "root").toString();
-                password = props.getOrDefault("scaling.it.native.mysql.password", "root").toString();
-                port = Integer.parseInt(props.getOrDefault("scaling.it.native.mysql.port", 3307).toString());
-                break;
+                return Integer.parseInt(props.getOrDefault("scaling.it.native.mysql.port", 3307).toString());
             case "PostgreSQL":
-                username = props.getOrDefault("scaling.it.native.postgresql.username", "postgres").toString();
-                password = props.getOrDefault("scaling.it.native.postgresql.password", "postgres").toString();
-                port = Integer.parseInt(props.getOrDefault("scaling.it.native.postgresql.port", 5432).toString());
-                break;
+                return Integer.parseInt(props.getOrDefault("scaling.it.native.postgresql.port", 5432).toString());
             case "openGauss":
-                username = props.getOrDefault("scaling.it.native.opengauss.username", "gaussdb").toString();
-                password = props.getOrDefault("scaling.it.native.opengauss.password", "Root@123").toString();
-                port = Integer.parseInt(props.getOrDefault("scaling.it.native.opengauss.port", 5432).toString());
-                break;
+                return Integer.parseInt(props.getOrDefault("scaling.it.native.opengauss.port", 5432).toString());
             default:
                 throw new UnsupportedOperationException("Unsupported database type: " + databaseType.getType());
         }
-        return new JdbcInfoEntity(username, password, port);
     }
     
     /**
@@ -137,16 +122,7 @@ public final class IntegrationTestEnvironment {
      * @return actual data source username
      */
     public String getActualDataSourceUsername(final DatabaseType databaseType) {
-        String username;
-        if (databaseType instanceof OpenGaussDatabaseType) {
-            username = "gaussdb";
-        } else {
-            username = "root";
-        }
-        if (itEnvType == ScalingITEnvTypeEnum.NATIVE) {
-            username = String.valueOf(props.getOrDefault(String.format("scaling.it.native.%s.username", databaseType.getType().toLowerCase()), username));
-        }
-        return username;
+        return String.valueOf(props.getOrDefault(String.format("scaling.it.native.%s.username", databaseType.getType().toLowerCase()), "root"));
     }
     
     /**
@@ -156,16 +132,7 @@ public final class IntegrationTestEnvironment {
      * @return actual data source username
      */
     public String getActualDataSourcePassword(final DatabaseType databaseType) {
-        String password;
-        if (databaseType instanceof OpenGaussDatabaseType) {
-            password = "Root@123";
-        } else {
-            password = "root";
-        }
-        if (itEnvType == ScalingITEnvTypeEnum.NATIVE) {
-            password = props.getOrDefault(String.format("scaling.it.native.%s.password", databaseType.getType().toLowerCase()), password).toString();
-        }
-        return password;
+        return String.valueOf(props.getOrDefault(String.format("scaling.it.native.%s.password", databaseType.getType().toLowerCase()), "root"));
     }
     
     /**
@@ -186,7 +153,7 @@ public final class IntegrationTestEnvironment {
     public List<String> listDatabaseDockerImageNames(final DatabaseType databaseType) {
         // Native mode needn't use docker image, just return a list which contain one item
         if (getItEnvType() == ScalingITEnvTypeEnum.NATIVE) {
-            return Collections.singletonList("");
+            return databaseType.getType().equalsIgnoreCase(getNativeDatabaseType()) ? Collections.singletonList("") : Collections.emptyList();
         }
         switch (databaseType.getType()) {
             case "MySQL":
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/BaseComposedContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/BaseComposedContainer.java
index c312a271123..998c35c270e 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/BaseComposedContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/BaseComposedContainer.java
@@ -38,6 +38,13 @@ public abstract class BaseComposedContainer implements Startable {
      */
     public abstract String getProxyJdbcUrl(String databaseName);
     
+    /**
+     * Clean up database.
+     *
+     * @param databaseName database name
+     */
+    public abstract void cleanUpDatabase(String databaseName);
+    
     @Override
     public void start() {
         getContainers().start();
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/DockerComposedContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/DockerComposedContainer.java
index 4dd2c0ac22e..1834e46a487 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/DockerComposedContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/DockerComposedContainer.java
@@ -60,4 +60,8 @@ public final class DockerComposedContainer extends BaseComposedContainer {
     public String getProxyJdbcUrl(final String databaseName) {
         return DataSourceEnvironment.getURL(databaseType, proxyContainer.getHost(), proxyContainer.getFirstMappedPort(), databaseName);
     }
+    
+    @Override
+    public void cleanUpDatabase(final String databaseName) {
+    }
 }
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/NativeComposedContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/NativeComposedContainer.java
index 6130d789d30..43c3c45bb7d 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/NativeComposedContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/compose/NativeComposedContainer.java
@@ -17,14 +17,29 @@
 
 package org.apache.shardingsphere.integration.data.pipeline.framework.container.compose;
 
+import lombok.SneakyThrows;
+import org.apache.shardingsphere.infra.database.metadata.url.JdbcUrlAppender;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.integration.data.pipeline.env.IntegrationTestEnvironment;
 import org.apache.shardingsphere.test.integration.env.DataSourceEnvironment;
 
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
+
 /**
  * Native composed container, you need start ShardingSphere-Proxy at firstly.
  */
 public final class NativeComposedContainer extends BaseComposedContainer {
     
+    private static final IntegrationTestEnvironment ENV = IntegrationTestEnvironment.getInstance();
+    
+    private final JdbcUrlAppender jdbcUrlAppender = new JdbcUrlAppender();
+    
     private final DatabaseType databaseType;
     
     public NativeComposedContainer(final DatabaseType databaseType) {
@@ -33,7 +48,59 @@ public final class NativeComposedContainer extends BaseComposedContainer {
     
     @Override
     public void start() {
-        
+        // do nothing
+    }
+    
+    @SneakyThrows
+    @Override
+    public void cleanUpDatabase(final String databaseName) {
+        int actualDatabasePort = ENV.getActualDatabasePort(databaseType);
+        String username = ENV.getActualDataSourceUsername(databaseType);
+        String password = ENV.getActualDataSourcePassword(databaseType);
+        String jdbcUrl;
+        switch (databaseType.getType()) {
+            case "MySQL":
+                String queryAllTables = String.format("select table_name from information_schema.tables where table_schema='%s' and table_type='BASE TABLE'", databaseName);
+                jdbcUrl = DataSourceEnvironment.getURL(databaseType, "localhost", actualDatabasePort, databaseName);
+                Properties properties = new Properties();
+                properties.setProperty("allowPublicKeyRetrieval", "true");
+                try (Connection connection = DriverManager.getConnection(jdbcUrlAppender.appendQueryProperties(jdbcUrl, properties), username, password)) {
+                    try (ResultSet resultSet = connection.createStatement().executeQuery(queryAllTables)) {
+                        List<String> actualTableNames = getFirstColumnValueFromResult(resultSet);
+                        for (String each : actualTableNames) {
+                            connection.createStatement().executeUpdate(String.format("drop table %s", each));
+                        }
+                    }
+                }
+                break;
+            case "openGauss":
+            case "PostgreSQL":
+                jdbcUrl = DataSourceEnvironment.getURL(databaseType, "localhost", actualDatabasePort, databaseName);
+                try (Connection connection = DriverManager.getConnection(jdbcUrl, username, password)) {
+                    dropTableWithSchema(connection, "public");
+                    dropTableWithSchema(connection, "test");
+                }
+                break;
+            default:
+        }
+    }
+    
+    private static List<String> getFirstColumnValueFromResult(final ResultSet resultSet) throws SQLException {
+        List<String> result = new LinkedList<>();
+        while (resultSet.next()) {
+            result.add(resultSet.getString(1));
+        }
+        return result;
+    }
+    
+    private void dropTableWithSchema(final Connection connection, final String schema) throws SQLException {
+        String queryAllTables = "select tablename from pg_tables where schemaname='%s'";
+        try (ResultSet resultSet = connection.createStatement().executeQuery(String.format(queryAllTables, schema))) {
+            List<String> actualTableNames = getFirstColumnValueFromResult(resultSet);
+            for (String each : actualTableNames) {
+                connection.createStatement().executeUpdate(String.format("drop table %s.%s", schema, each));
+            }
+        }
     }
     
     @Override
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/MySQLContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/MySQLContainer.java
index 3118aee9c26..9a8aa55701b 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/MySQLContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/MySQLContainer.java
@@ -29,7 +29,7 @@ public final class MySQLContainer extends DatabaseContainer {
     
     private static final DatabaseType DATABASE_TYPE = new MySQLDatabaseType();
     
-    private final String username = "root";
+    private final String username = "scaling";
     
     private final String password = "root";
     
@@ -41,13 +41,14 @@ public final class MySQLContainer extends DatabaseContainer {
     
     @Override
     protected void configure() {
-        withCommand("--sql_mode=", "--default-authentication-plugin=mysql_native_password");
+        withCommand("--sql_mode=", "--default-authentication-plugin=mysql_native_password", "--lower_case_table_names=1");
         addEnv("LANG", "C.UTF-8");
-        addEnv("MYSQL_ROOT_PASSWORD", username);
+        addEnv("MYSQL_ROOT_PASSWORD", "root");
         addEnv("MYSQL_ROOT_HOST", "%");
         withClasspathResourceMapping("/env/mysql/my.cnf", "/etc/mysql/my.cnf", BindMode.READ_ONLY);
+        withClasspathResourceMapping("/env/mysql/initdb.sql", "/docker-entrypoint-initdb.d/", BindMode.READ_ONLY);
         withExposedPorts(port);
-        setWaitStrategy(new JDBCConnectionWaitStrategy(() -> DriverManager.getConnection(DataSourceEnvironment.getURL(DATABASE_TYPE, "localhost", getFirstMappedPort()), "root", "root")));
+        setWaitStrategy(new JDBCConnectionWaitStrategy(() -> DriverManager.getConnection(DataSourceEnvironment.getURL(DATABASE_TYPE, "localhost", getFirstMappedPort()), username, password)));
     }
     
     @Override
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/OpenGaussContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/OpenGaussContainer.java
index a9acbc33c43..f7a6d96952d 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/OpenGaussContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/OpenGaussContainer.java
@@ -39,11 +39,8 @@ public final class OpenGaussContainer extends DatabaseContainer {
     
     private final int port = 5432;
     
-    private String dockerImageName = "";
-    
     public OpenGaussContainer(final String dockerImageName) {
         super(DATABASE_TYPE, dockerImageName);
-        this.dockerImageName = dockerImageName;
     }
     
     @Override
@@ -51,6 +48,8 @@ public final class OpenGaussContainer extends DatabaseContainer {
         withCommand("--max_connections=600");
         addEnv("GS_PASSWORD", password);
         withClasspathResourceMapping("/env/postgresql/postgresql.conf", "/usr/local/opengauss/share/postgresql/postgresql.conf.sample", BindMode.READ_ONLY);
+        withClasspathResourceMapping("/env/postgresql/initdb.sql", "/docker-entrypoint-initdb.d/", BindMode.READ_ONLY);
+    
         withPrivilegedMode(true);
         withExposedPorts(port);
         setWaitStrategy(new JDBCConnectionWaitStrategy(() -> DriverManager.getConnection(DataSourceEnvironment.getURL(DATABASE_TYPE, "localhost", getFirstMappedPort(), "postgres"),
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/PostgreSQLContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/PostgreSQLContainer.java
index 424a3f0a5fe..a6e3e3bf27a 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/PostgreSQLContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/database/PostgreSQLContainer.java
@@ -29,7 +29,7 @@ public final class PostgreSQLContainer extends DatabaseContainer {
     
     private static final DatabaseType DATABASE_TYPE = new PostgreSQLDatabaseType();
     
-    private final String username = "root";
+    private final String username = "scaling";
     
     private final String password = "root";
     
@@ -43,12 +43,15 @@ public final class PostgreSQLContainer extends DatabaseContainer {
     protected void configure() {
         withCommand("--max_connections=600");
         withCommand("--wal_level=logical");
-        addEnv("POSTGRES_USER", username);
-        addEnv("POSTGRES_PASSWORD", password);
+        String rootUsername = "root";
+        String rootPassword = "root";
+        addEnv("POSTGRES_USER", rootUsername);
+        addEnv("POSTGRES_PASSWORD", rootPassword);
         withClasspathResourceMapping("/env/postgresql/postgresql.conf", "/etc/postgresql/postgresql.conf", BindMode.READ_ONLY);
+        withClasspathResourceMapping("/env/postgresql/initdb.sql", "/docker-entrypoint-initdb.d/", BindMode.READ_ONLY);
         withExposedPorts(port);
         setWaitStrategy(new JDBCConnectionWaitStrategy(() -> DriverManager.getConnection(DataSourceEnvironment.getURL(DATABASE_TYPE, "localhost", getFirstMappedPort(), "postgres"),
-                username, password)));
+                rootUsername, rootPassword)));
     }
     
     @Override
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/proxy/ShardingSphereProxyDockerContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/proxy/ShardingSphereProxyDockerContainer.java
index ce325d7b262..c6b22ae64a7 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/proxy/ShardingSphereProxyDockerContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/container/proxy/ShardingSphereProxyDockerContainer.java
@@ -19,8 +19,6 @@ package org.apache.shardingsphere.integration.data.pipeline.framework.container.
 
 import lombok.extern.slf4j.Slf4j;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.integration.data.pipeline.env.IntegrationTestEnvironment;
-import org.apache.shardingsphere.integration.data.pipeline.env.enums.ScalingITEnvTypeEnum;
 import org.apache.shardingsphere.integration.data.pipeline.util.DatabaseTypeUtil;
 import org.apache.shardingsphere.test.integration.env.DataSourceEnvironment;
 import org.apache.shardingsphere.test.integration.framework.container.atomic.DockerITContainer;
@@ -56,9 +54,5 @@ public final class ShardingSphereProxyDockerContainer extends DockerITContainer
     private void mapConfigurationFiles() {
         withClasspathResourceMapping(String.format("/env/%s/server.yaml", databaseType.getType().toLowerCase()), "/opt/shardingsphere-proxy/conf/server.yaml", BindMode.READ_ONLY);
         withClasspathResourceMapping("/env/logback.xml", "/opt/shardingsphere-proxy/conf/logback.xml", BindMode.READ_ONLY);
-        if (ScalingITEnvTypeEnum.NATIVE == IntegrationTestEnvironment.getInstance().getItEnvType()) {
-            addFixedExposedPort(3307, 3307);
-            addFixedExposedPort(5005, 3308);
-        }
     }
 }
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/it-env.properties b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/it-env.properties
index d440ba50b37..ea582dc9624 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/it-env.properties
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/it-env.properties
@@ -14,15 +14,15 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-# it.type=DOCKER,NATIVE
+# scaling.it.type=DOCKER,NATIVE
 scaling.it.env.type=
-# it.docker.mysql.version=mysql:5.7,mysql:8.0
+# scaling.it.docker.mysql.version=mysql:5.7,mysql:8.0
 scaling.it.docker.mysql.version=
-# it.docker.postgresql.version=postgres:10-alpine,postgres:11-alpine,postgres:12-alpine,postgres:13-alpine,postgres:14-alpine
+# scaling.it.docker.postgresql.version=postgres:10-alpine,postgres:11-alpine,postgres:12-alpine,postgres:13-alpine,postgres:14-alpine
 scaling.it.docker.postgresql.version=
-# it.docker.opengauss.version=enmotech/opengauss:3.0.0,enmotech/opengauss:2.1.0
+# scaling.it.docker.opengauss.version=enmotech/opengauss:3.0.0,enmotech/opengauss:2.1.0
 scaling.it.docker.opengauss.version=
-# it.native.database=mysql or postgresql or opengauss
+# scaling.it.native.database=mysql or postgresql or opengauss
 scaling.it.native.database=
 scaling.it.native.mysql.username=root
 scaling.it.native.mysql.password=root
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/initdb.sql b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/initdb.sql
index 95ab61e3196..b856d3cc87a 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/initdb.sql
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/initdb.sql
@@ -15,5 +15,11 @@
 -- limitations under the License.
 --
 
-CREATE USER IF NOT EXISTS 'root'@'%' IDENTIFIED BY 'root';
-GRANT All privileges ON *.* TO 'root'@'%';
+CREATE DATABASE scaling_it_0;
+CREATE DATABASE scaling_it_1;
+CREATE DATABASE scaling_it_2;
+CREATE DATABASE scaling_it_3;
+CREATE DATABASE scaling_it_4;
+CREATE USER IF NOT EXISTS 'scaling'@'%' IDENTIFIED BY 'root';
+GRANT Replication Client, Replication Slave, Select, Insert, Update, Delete, Index ON *.* TO `scaling`@`%`;
+GRANT Create, Drop ON TABLE *.* TO scaling;
\ No newline at end of file
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/initdb.sql b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/postgresql/initdb.sql
similarity index 58%
copy from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/initdb.sql
copy to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/postgresql/initdb.sql
index 95ab61e3196..d0febc188c8 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/initdb.sql
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/postgresql/initdb.sql
@@ -13,7 +13,17 @@
 -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 -- See the License for the specific language governing permissions and
 -- limitations under the License.
---
 
-CREATE USER IF NOT EXISTS 'root'@'%' IDENTIFIED BY 'root';
-GRANT All privileges ON *.* TO 'root'@'%';
+CREATE DATABASE scaling_it_0;
+CREATE DATABASE scaling_it_1;
+CREATE DATABASE scaling_it_2;
+CREATE DATABASE scaling_it_3;
+CREATE DATABASE scaling_it_4;
+CREATE USER scaling WITH ENCRYPTED PASSWORD 'root';
+CREATE DATABASE scaling;
+ALTER ROLE scaling CREATEDB REPLICATION;
+GRANT CREATE, CONNECT ON DATABASE scaling_it_0 TO scaling;
+GRANT CREATE, CONNECT ON DATABASE scaling_it_1 TO scaling;
+GRANT CREATE, CONNECT ON DATABASE scaling_it_2 TO scaling;
+GRANT CREATE, CONNECT ON DATABASE scaling_it_3 TO scaling;
+GRANT CREATE, CONNECT ON DATABASE scaling_it_4 TO scaling;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/scenario/primarykey/text_primary_key/mysql.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/scenario/primarykey/text_primary_key/mysql.xml
index bbcbceb69c9..e4842f66c09 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/scenario/primarykey/text_primary_key/mysql.xml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/scenario/primarykey/text_primary_key/mysql.xml
@@ -16,7 +16,7 @@
   -->
 <command>
     <create-table-order>
-        CREATE TABLE `t_order` (
+        CREATE TABLE `T_ORDER` (
         `id` varchar(255) NOT NULL COMMENT 'pk id',
         `order_id` INT NOT NULL,
         `user_id` INT NOT NULL,