- What's New
- Product Bulletin
- Service Overview
- Billing
- Getting Started
-
User Guide
- Function Overview
- Kernel Version Notes
- Permissions Management
-
Instance Management
- Instance Statuses
- Buying a DDM instance
- Splitting Read-only and Read-Write Services
- Changing Node Class
- Scaling Out a DDM Instance
- Scaling In a DDM Instance
- Restarting a DDM Instance or an Instance Node
- Deleting Pay-per-Use Instances
- Reloading Table Data
- Changing a Parameter Template
- Modifying Parameters of a DDM Instance
- Rolling Back the Version of a DDM Instance
- Upgrading the Version of a DDM Instance
- Upgrading the DDM Engine and OS
- Connection Management
- Schema Management
- Shard Configuration
- Data Nodes
-
Parameter Template Management
- Instance Parameters
- Creating a Parameter Template
- Modifying a Custom Parameter Template
- Comparing Two Parameter Templates
- Viewing Parameter Change History
- Replicating a Parameter Template
- Applying a Parameter Template
- Viewing Application Records of a Parameter Template
- Modifying the Description of a Parameter Template
- Deleting a Parameter Template
- Account Management
- Backups and Restorations
-
Data Migration
- Overview
- Migration Evaluation
- Scenario 1: Migrating Data from an On-Premises MySQL Instance to DDM
- Scenario 2: Migrating Data from a Third-Party Cloud MySQL Instance to DDM
- Scenario 3: Migrating Data from an ECS-hosted MySQL Instance on Huawei Cloud to DDM
- Scenario 4: Exporting Data from a DDM Instance
- Scenario 5: Migrating Data from Heterogeneous Databases to DDM
- Scenario 6: Migrating Data from Huawei Cloud RDS for MySQL to DDM
- Session Management
- Slow Queries
- Monitoring and Alarm Reporting
- Task Center
- Tags
- Auditing
-
SQL Syntax
- Introduction
- DDL
- DML
- Online DDL
- Functions
- Unsupported Objects and Use Constraints
- Supported SQL Statements
- Global Sequence
- Database Management Syntax
- Advanced SQL Functions
- Quotas
-
API Reference
- Before You Start
- API Overview
- Calling APIs
-
APIs (Recommended)
-
DDM Instances
- Buying a DDM instance
- Querying DDM Instances
- Querying Details of a DDM Instance
- Modifying the Name of a DDM Instance
- Changing the Security Group of a DDM Instance
- Deleting a DDM Instance
- Restarting a DDM Instance
- Reloading Table Data
- Scaling Out a DDM Instance
- Scaling in a DDM instance
- Modifying the Read Policy of the Associated DB Instance
- Synchronizing Data Node Information
- Querying Nodes of a DDM Instance
- Querying Details of a DDM Instance Node
- Querying Parameters of a Specified DDM Instance
- Modifying Parameters of a DDM Instance
- Querying DDM Engine Information
- Querying DDM Node Classes Available in an AZ
- Changing the Node Class of a DDM Instance
- Obtaining the Instance Group Information
- Creating an Instance Group
- Schemas
- Accounts
- Monitoring
- Session Management
- Application Examples
-
DDM Instances
- Permissions Policies and Supported Actions
- Appendix
- SDK Reference
-
Best Practices
- Overview
- Formulating Sharding Rules
- Determining the Number of Shards in a Schema
- Using Broadcast and Unsharded Tables
- Transaction Models
- SQL Standards
- Migrating an Entire RDS Database to DDM
- Migrating an Entire MyCat Database to DDM
- Accessing DDM Using a JDBC Connection Pool
- Logging In to a DDM Instance Using Navicat
- Migrating Data from RDS for MySQL to DDM Using DRS
- Sharding Database and Table Data of an RDS for MySQL Instance
- Performance White Paper
-
FAQs
- General Questions
-
DDM Usage
- How Does DDM Perform Sharding?
- What Do I Do If I Fail to Connect to a DDM Instance Using the JDBC Driver?
- Why It Takes So Long Time to Export Data from MySQL Using mysqldump?
- What Do I Do If a Duplicate Primary Key Error Occurs When Data Is Imported into DDM?
- What Should I Do If an Error Message Is Returned When I Specify an Auto-Increment Primary Key During Migration?
- What Do I Do If an Error Is Reported When Parameter Configuration Does Not Time Out?
- Which Should I Delete First, a Schema or its Associated RDS Instances?
- Can I Manually Delete Databases and Accounts Remained in Data Nodes After a Schema Is Deleted?
- SQL Syntax
-
RDS-related Questions
- Is the Name of a Database Table Case-Sensitive?
- What Risky Operations on RDS for MySQL Will Affect DDM?
- How Do I Handle Data with Duplicate Primary Keys in a Table?
- How Can I Query RDS for MySQL Information by Running Command show full innodb status?
- What Should I Pay Attention to When Selecting RDS for MySQL Instance Specifications?
- Connection Management
- Resource Freezing, Release, Deletion, and Unsubscription
- Videos
-
More Documents
-
User Guide (ME-Abu Dhabi Region)
- Service Overview
- Getting Started
- Function Overview
- Instance Management
-
Parameter Template Management
- Creating a Parameter Template
- Editing a Parameter Template
- Comparing Two Parameter Templates
- Viewing Parameter Change History
- Replicating a Parameter Template
- Applying a Parameter Template
- Viewing Application Records of a Parameter Template
- Modifying the Description of a Parameter Template
- Deleting a Parameter Template
- Task Center
- Schema Management
- Account Management
- Backup Management
- Monitoring Management
- Auditing
-
SQL Syntax
- Introduction
- DDL
- DML
- Functions
- Unsupported Items
- Supported SQL Statements
- Global Sequence
- Database Management Syntax
- Advanced SQL Functions
-
FAQs
- General Questions
-
DDM Usage
- How Can I Rectify a Fault in Accessing DDM by Using the JDBC Driver?
- What Version and Parameters Should I Select?
- Why It Takes So Long Time to Export Data from MySQL Using mysqldump?
- How Should I Handle the Duplicate Primary Key Error Occurring After Data Is Imported into DDM?
- What Should I Do If an Error Message Is Returned After I Specify an Auto-Increment Primary Key?
- How Do I Handle the Error Reported When Parameter Configuration Does Not Time Out?
- Which Should I Delete First, Schema or Associated RDS DB Instances?
- Should I Manually Delete Databases and Accounts Remained in the Associated RDS DB Instances After a Schema Is Deleted?
- SQL Syntax
- RDS-related Questions
- Connection Management
-
User Guide (Kuala Lumpur Region)
- Service Overview
- Getting Started
- Function Overview
- Instance Management
-
Parameter Template Management
- Creating a Parameter Template
- Editing a Parameter Template
- Comparing Two Parameter Templates
- Viewing Parameter Change History
- Replicating a Parameter Template
- Applying a Parameter Template
- Viewing Application Records of a Parameter Template
- Modifying the Description of a Parameter Template
- Deleting a Parameter Template
- Task Center
- Schema Management
- Account Management
- Backup Management
- Monitoring Management
- Auditing
-
SQL Syntax
- Introduction
- DDL
- DML
- Functions
- Unsupported Items
- Supported SQL Statements
- Global Sequence
- Database Management Syntax
- Advanced SQL Functions
-
FAQs
- General Questions
-
DDM Usage
- How Can I Rectify a Fault in Accessing DDM by Using the JDBC Driver?
- What Version and Parameters Should I Select?
- Why It Takes So Long Time to Export Data from MySQL Using mysqldump?
- How Should I Handle the Duplicate Primary Key Error Occurring After Data Is Imported into DDM?
- What Should I Do If an Error Message Is Returned After I Specify an Auto-Increment Primary Key?
- How Do I Handle the Error Reported When Parameter Configuration Does Not Time Out?
- Which Should I Delete First, Schema or Associated RDS DB Instances?
- Should I Manually Delete Databases and Accounts Remained in the Associated RDS DB Instances After a Schema Is Deleted?
- SQL Syntax
- RDS-related Questions
- Connection Management
-
API Reference (Kuala Lumpur Region)
- Before You Start
- API Overview
- Calling APIs
-
DDM Instance Management
- Querying DDM Engine
- Querying the Quota of Classes Available in Each AZ
- Creating a DDM Instance
- Querying DDM Instances
- Viewing Details of a DDM Instance
- Modifying the Name of a DDM Instance
- Modifying the Security Group of a DDM Instance
- Deleting a DDM Instance
- Restarting a DDM Instance
- Reloading Table Data
- Scaling Out a DDM instance
- Scaling In a DDM instance
- Modifying the Read Policy of the Associated DB Instance
- Synchronizing DB Instance Data
- Querying Nodes of a DDM Instance
- Querying Details of a DDM Instance Node
- Querying Parameters of a Specified DDM Instance
- Modifying Parameters of a DDM Instance
- Schema Management
- Account Management
- Monitoring Management
- Permissions Policies and Supported Actions
- Appendix
- Change History
-
User Guide (ME-Abu Dhabi Region)
- General Reference
Copied.
Step 6: Log In to the DDM Instance or Schema
After you create a DDM instance, you can log in to it using a client such as Navicat, or connect to the required schema in the instance using the CLI or JDBC driver.
This section describes how to log in to a DDM instance or a schema.
Preparations
Before login to your DDM instance or schema, you have to obtain the connection address of your DDM instance or schema.
Obtaining the Instance Connection Address
- Log in to the management console.
- Hover on the left menu to display Service List and choose Database > Distributed Database Middleware.
- In the navigation pane, choose Instances. In the instance list, locate the required instance and click its name.
- In the Network Information area, view the connection address.
NOTE:
If you enter an incorrect password for five times or more when attempting to access your DDM instance, the system will be locked for 20 minutes.
Obtaining the Schema Connection Address
- Log in to the management console.
- Hover on the left menu to display Service List and choose Database > Distributed Database Middleware.
- In the navigation pane, choose Instances. In the instance list, locate the required DDM instance and click its name.
- In the navigation pane, choose Schemas.
- In the schema list, locate the required schema and click its name.
- At the Connection Address area, view the CLI and JDBC connection addresses.
Figure 1 Schema connection address
NOTE:
If you enter an incorrect password for five times or more when attempting to access your DDM instance, the system will be locked for 20 minutes.
Connection Methods
For details about method 1, see Using Navicat to Log In to a DDM Instance.
For details about method 2, see Using the MySQL CLI to Log In to a Schema.
For details about method 3, see Using a JDBC Driver to Log In to a Schema.
For details about method 4, see Log In to a DDM Instance on the DDM Console.
- For security purposes, use an ECS in the same VPC as your DDM instance.
- Ensure that a MySQL client has been installed on the required ECS or the MySQL connection driver has been configured.
- Before you log in to a DDM instance, configure its information on the client or connection driver.
Using Navicat to Log In to a DDM Instance
- Log in to the DDM console, locate the required DDM instance, and click its name.
- In the Instance Information area, click Bind and select an EIP available.
- In the left pane, click the VPC icon and choose Access Control > Security Groups.
- On the Security Groups page, locate the required security group and click Manage Rule in the Operation column. On the displayed page, click Add Rule. Configure the security group rule as needed and click OK.
NOTE:
After binding an EIP to your DDM instance, set strict inbound and outbound rules for the security group to enhance database security.
- Open Navicat and click Connection. In the displayed dialog box, enter the host IP address (EIP), username, and password (DDM account).
- Click Test Connection. If a message is returned indicating that the connection is successful, click OK. The connection will succeed 1 to 2 minutes later. If the connection fails, the failure cause is displayed. Modify the required information and try again.
Using Navicat to access a DDM instance is similar to using other visualized MySQL tools such as MySQL Workbench. Therefore, the procedure of using other visualized MySQL tools to connect to a DDM instance has been omitted.
Using the MySQL CLI to Log In to a Schema
- Log in to the required ECS, open the CLI, and run the following command:
mysql -h ${DDM_SERVER_ADDRESS} -P${DDM_SERVER_PORT} -u${DDM_USER} -p [-D${DDM_DBNAME}] [--default-character-set=utf8][--default_auth=mysql_native_password]
Table 1 Parameter description Example Parameter
Description
Example Value
DDM_SERVER_ADDRESS
IP address of the DDM instance
192.168.0.200
DDM_SERVER_PORT
Connection port of the DDM instance
5066
DDM_USER
Account of the DDM instance
dbuser01
DDM_DBNAME
(Optional) Name of the target schema in the DDM instance
-
default-character-set=utf8
(Optional) Select character set UTF-8 for encoding.
Configure this parameter if garbled characters are displayed during parsing due to inconsistency between MySQL connection code and actually used code.
-
default_auth=mysql_native_password
The password authentication plug-in is used by default.
-
NOTE:
If you use the MySQL 8.0 client, set default_auth to mysql_native_password.
- View the command output. The following is an example output of running a MySQL command in the Windows CLI.
C:\Users\testDDM>mysql -h192.168.0.200 -P5066 -Ddb_5133 -udbuser01 -p Enter password: Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ;or \g. Your MySQL connection id is 5 Server version: 5.6.29 Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
Using a JDBC Driver to Log In to a Schema
- Load the required JDBC driver.
Class.forname(com.mysql.jdbc.Driver);
NOTE:
JDBC drivers 5.1.35 to 5.1.45 are recommended.
- Create a database connection.
String username = "dbuser01" ; String password = "xxxxxx" ; String url = "jdbc:mysql://192.168.0.200:5066/db_5133"; Connection con = DriverManager.getConnection(url , username , password);
- Create a Statement object.
Statement stmt = con.createStatement();
- Execute the required SQL statement.
ResultSet rs = stmt.executeQuery("select now() as Systemtime"); con.close();
- (Optional) Optimize code as needed.
loadBalanceAutoCommitStatementThreshold=5&loadBalanceHostRemovalGracePeriod=15000&loadBalanceBlacklistTimeout=60000&loadBalancePingTimeout=5000&retriesAllDown=10&connectTimeout=10000";
NOTE:
- Parameters loadBalanceAutoCommitStatementThreshold and retriesAllDown must be configured based on the example in 5. Otherwise, an infinite loop may occur during the connection switchover, resulting in stack overflow.
- loadBalanceAutoCommitStatementThreshold: defines the number of matching statements which will trigger the driver to potentially swap physical server connections.
- loadBalanceHostRemovalGracePeriod: indicates the grace period to wait for a host being removed from a load-balanced connection, to be released when it is the active host.
- loadBalanceBlacklistTimeout: indicates the time in milliseconds between checks of servers which are unavailable, by controlling how long a server lives in the global blacklist.
- loadBalancePingTimeout: indicates the time in milliseconds that the connection will wait for a response to a ping operation when you set loadBalanceValidateConnectionOnSwapServer to true.
- retriesAllDown: indicates the maximum number of connection attempts before an exception is thrown when a valid host is searched. SQLException will be returned if the threshold of retries is reached with no valid connections obtained.
- connectTimeout: indicates the maximum amount of time in milliseconds that the JDBC driver is willing to wait to set up a socket connection. 0 indicates that the connection does not time out. Only JDK-1.4 or later is supported. The default value 0.
Log In to a DDM Instance on the DDM Console
- Log in to the DDM console.
- In the navigation pane, choose Instances.
- In the instance list, locate the required instance and click Log In in the Operation column.
On the displayed page, enter the required username and password.
- On the displayed page, enter username and password of the DDM account.
- Click Test Connection.
- (Optional) Enable Collect Metadata Periodically and Show Executed SQL Statements.
- Ensure that all settings are correct and click Log In.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot