このページは、お客様の言語ではご利用いただけません。Huawei Cloudは、より多くの言語バージョンを追加するために懸命に取り組んでいます。ご協力ありがとうございました。
- What's New
- Function Overview
- Product Bulletin
- Service Overview
- Billing
- Getting Started
-
Kernel
- TaurusDB Kernel Version Release History
-
Common Kernel Functions
- Parallel Query
- Near Data Processing
- DDL Optimization
- Fast Binlog Positioning
- Backward Index Scan
- Statement Outline
- Idle Transaction Disconnection
- LIMIT...OFFSET Pushdown
- Conversion of IN Predicates Into Subqueries
- DISTINCT Optimization for Multi-Table Joins
- Diagnosis on Large Transactions
- Enhanced Partitioned Tables
- Hot Row Update
- Multi-tenancy
- Column Compression
- Table Recycle Bin
- Cold Data Preloading for Read Replicas
- Self-Healing of Read Replicas upon a Replication Latency
-
User Guide
- Permissions Management
- Buying a DB Instance
- Connecting to a DB Instance
- Database Usage
- Data Migration
-
Instance Management
- Viewing the Overall Status of DB Instances
- Viewing Metrics
- Instance Lifecycle Management
-
Configuration Changes
- Changing the vCPUs and Memory of a DB Instance or Node
- Changing the Storage Space of a DB Instance
- Configuring Auto Scaling Policies for a DB Instance
- Changing the Maintenance Window of a DB Instance
- Customizing Displayed Items of the Instance List
- Upgrading the Minor Kernel Version of a DB Instance
- Updating the OS of a DB Instance
- Data Backups
- Data Restorations
- Serverless Instances
- Multi-primary Instances (OBT)
- Read Replicas
-
Database Proxy (Read/Write Splitting)
- What Is Database Proxy?
- Creating a Proxy Instance for Read/Write Splitting
-
Changing Configurations of a Proxy Instance
- Changing the Consistency Level of a Proxy Instance
- Enabling the Connection Pool for a Proxy Instance
- Enabling Transaction Splitting for a Proxy Instance
- Modifying the Routing Policy of a Proxy Instance
- Changing Read Weights of Nodes
- Changing the Multi-statement Processing Mode of a Proxy Instance
- Enabling Automatic Association of New Nodes with a Proxy Instance
- Enabling Access Control for a Proxy Instance
- Changing the Specifications of a Proxy Instance
- Changing the Number of Nodes for a Proxy Instance
- Applying for a Private Domain Name for a Proxy Instance
- Changing the Port of a Proxy Instance
- Changing the Proxy Address of a Proxy Instance
- Modifying Parameters of a Proxy Instance
- Binding an EIP to a Proxy Instance
- Proxy Instance Lifecycle
- Proxy Instance Kernel Versions
- Using Hints for Read/Write Splitting
- DBA Assistant
- Parameter Management
- Security and Encryption
- Cold and Hot Data Separation (OBT)
- Application Lossless and Transparent (ALT)
-
HTAP Analysis (Standard Edition)
- What Is HTAP of Standard Edition?
- Connecting to an HTAP Instance for Complex OLAP Queries
- Connecting to a Standard HTAP Instance
-
Standard HTAP Instance Management
- Rebooting a Standard HTAP Instance
- Rebooting a Node of a Standard HTAP Instance
- Changing Storage Space of a Standard HTAP Instance
- Adding Read Replicas to a Standard HTAP Instance
- Deleting a Standard HTAP Instance
- Adjusting Blacklisted or Whitelisted Tables of a Standard HTAP Instance and Repairing Tables
- Standard HTAP Account Management
- Viewing Metrics of a Standard HTAP Instance or Nodes
- Syntax and Data Type Mappings Between HTAP and TaurusDB Instances
- Performance Tuning
-
RegionlessDB Clusters (OBT)
- What Is a RegionlessDB Cluster?
- Using a RegionlessDB Cluster for Remote Multi-Active DR
- Using a RegionlessDB Cluster for Remote DR
- Performing a Primary/Standby Switchover or Failover in a RegionlessDB Cluster
- Removing a Standby Instance from a RegionlessDB Cluster
- Deleting a RegionlessDB Cluster
- Viewing the Replication Latency and Traffic of a RegionlessDB Cluster
- Monitoring and Alarms
- Logs and Auditing
- Task Center
- Tag Management
- Quota Management
- Best Practices
- Performance White Paper
-
API Reference
- Before You Start
- API Overview
- Calling APIs
-
APIs (Recommended)
- DB Engine Version Queries
- Database Specification Queries
-
Instance Management
- Creating a DB Instance
- Rebooting a DB Instance
- Deleting/Unsubscribing from a DB Instance
- Creating a Read Replica
- Deleting or Unsubscribing from a Read Replica
- Scaling up Storage of a Yearly/Monthly DB Instance
- Changing a DB Instance Name
- Resetting a Database Password
- Changing DB Instance Specifications
- Querying Dedicated Resource Pools
- Querying Dedicated Resources
- Configuring the Monitoring By Seconds Function
- Querying the Configuration of Monitoring by Seconds
- Rebooting a Node
- Upgrading the Kernel Version of a DB Instance
- Enabling or Disabling SSL
- Binding an EIP
- Unbinding an EIP
- Promoting a Read Replica to Primary
- Changing a Maintenance Window
- Changing a Security Group
- Changing a Private IP Address
- Changing a Database Port
- Changing a DB Instance Description
- Applying for a Private Domain Name
- Changing a Private Domain Name
- Querying the Kernel Version
- Modifying Auto Scaling Policies
- Querying Auto Scaling Policies
- Pre-Checking Resources
- Querying DB instances
- Querying Details of a DB Instance
- Querying Details of DB Instances in Batches
- Modifying a Recycling Policy
- Querying a Recycling Policy
- Querying Instances in the Recycle Bin
- Changing Node Names in Batches
- Querying Historical Records of Auto Scaling
- Setting a Policy for a Serverless DB Instance
- Changing the Failover Priority of a Read Replica
- Querying an EIP
-
Backup Management
- Configuring a Same-Region Backup Policy
- Creating a Manual Backup
- Querying Full Backups
- Querying an Automated Backup Policy
- Deleting a Manual Backup
- Restoring Data to the Original Instance or an Existing Instance
- Querying the Restoration Time Range
- Enabling or Disabling Encrypted Backup
- Checking Whether Encrypted Backup Is Enabled
- Querying Incremental Backups
- Configuring a Cross-Region Backup Policy
- Restoring Tables to a Specified Point in Time
- Querying Tables for Table-level Point-in-Time Recovery
-
Parameter Template Management
- Querying Parameter Templates
- Creating a Parameter Template
- Deleting a Parameter Template
- Obtaining Details About a Parameter Template
- Modifying Parameters in a Parameter Template
- Applying a Parameter Template
- Replicating a Parameter Template
- Comparing Parameter Templates
- Querying Instances That a Parameter Template Can Be Applied To
- Viewing Parameter Change History
- Obtaining Parameter Information of a Specified DB Instance
- Modifying Parameters of a Specified DB Instance
- Replicating the Parameter Template of a DB Instance
- Querying Application Records of a Parameter Template
- Quota Management
-
Database Proxy
- Creating a Proxy Instance
- Deleting a Proxy Instance
- Querying Proxy Instances
- Querying Proxy Instance Specifications
- Adding Proxy Nodes
- Deleting Proxy Nodes
- Changing the Specifications of a Proxy Instance
- Assigning Read Weights
- Changing the Routing Policy of a Proxy Instance
- Enabling or Disabling Transaction Splitting for a Proxy Instance
- Enabling or Disabling Automatic Association of New Nodes with Proxy Instances
- Changing Session Consistency of a Proxy Instance
- Changing the Connection Pool Type of a Proxy Instance
- Changing the Port of a Proxy Instance
- Upgrading the Kernel Version of a Proxy Instance
- Modifying the Name of a Proxy Instance
- Querying Access Control Settings of a Proxy Instance
- Querying the Minor Version of a Proxy Instance
- Modifying Parameters of a Proxy Instance
- Querying Kernel Parameters of a Proxy Instance
- Enabling or Disabling Access Control
- Configuring Access Control Rules
- Enabling or Disabling SSL for a Proxy Instance
- Rebooting a Proxy Instance
-
Log Management
- Enabling or Disabling SQL Explorer
- Querying Whether SQL Explorer Is Enabled
- Querying Slow Query Logs
- Querying Error Logs
- Obtaining the Temporary Link for Downloading Full SQL
- Querying LTS Configurations of an Instance
- Deleting LTS Configurations in Batches
- Creating LTS Configurations in Batches
- Querying Whether Show Original Log Is Enabled
- Enabling or Disabling Show Original Log
- Querying Slow Query Log Statistics
- Obtaining Links for Downloading Slow Query Logs
- Tag Management
- Database User Management
- Database Management
- Traffic Management
- Task Center
- Intelligent Diagnosis
-
HTAP (Standard Edition)
- Restoring a Data Synchronization Task for a StarRocks Instance
- Stopping a Data Synchronization Task for a StarRocks Instance
- Checking Table Configurations for HTAP Data Synchronization
- Creating a StarRocks Instance
- Querying a StarRocks Instance
- Deleting a StarRocks Instance
- Rebooting a StarRocks Instance
- Rebooting a StarRocks Node
- Checking StarRocks Resources
- Querying HTAP Engine Resources
- Obtaining the Storage Type of an HTAP Instance
- Querying Specifications of an HTAP Instance
- Querying HTAP Instances
- Creating a Data Synchronization Task for a StarRocks Instance
- Deleting a Data Synchronization Task for a StarRocks Instance
- Querying Data Synchronization Tasks of a StarRocks Instance
- Checking Database Configurations for HTAP Data Synchronization
- Querying Configurations of a StarRocks Data Synchronization Task
- Querying Database Parameter Settings for StarRocks Data Synchronization
- Querying Databases of a StarRocks Instance
- Querying Database Accounts
- Creating a Database Account
- Deleting a Database Account
- Changing the Password of a Database Account
- Changing Permissions of a Database Account
- Changing the Specifications of a StarRocks Instance
- Querying Parameters
- Modifying Parameters
- Enabling Assign Requests to Row and Column Store Nodes for a StarRocks Instance
- Comparing Parameters
- Multi-tenancy
-
APIs (Unavailable Soon)
- DB Engine Version Queries
- Database Specification Queries
-
Instance Management
- Creating a DB Instance
- Querying DB Instances
- Querying DB Instances
- Deleting a DB Instance
- Querying Details of a DB Instance
- Querying Details of DB Instances in Batches
- Querying Details of a DB Instance
- Creating a Read Replica
- Deleting a Read Replica
- Scaling up Storage of a Yearly/Monthly DB Instance
- Changing a DB Instance Name
- Resetting a Database Password
- Modifying DB Instance Specifications
- Backup Management
- Parameter Template Management
- Quota Management
- Database Proxy
- Log Management
- Task Information Queries
- Permissions Policies and Supported Actions
- Appendix
- SDK Reference
-
FAQs
- Product Consulting
- Resource Freezing, Unfreezing, Release, Deletion, and Unsubscription
-
Database Connections
- What Should I Do If I Can't Connect to My TaurusDB Instance?
- What Should I Do If an ECS Can't Connect to a TaurusDB Instance?
- Can an External Server Access a TaurusDB Instance?
- What Is the Maximum Number of Connections to a TaurusDB Instance?
- What Do I Do If There Are Too Many Database Connections?
- Are There Any Risks If There Are Too Many Connections to a TaurusDB Instance?
- What Should I Do If the Network Connectivity Test Fails?
- Can I Access a TaurusDB Instance over an Intranet Connection Across Regions?
- How Do I Check the Connections to a TaurusDB Instance?
- How Do I Enable Availability Detection for a Connection Pool in the Service Code?
- Client Installation
- Database Migration
- Database Permissions
-
Database Performance
- What Should I Do If the CPU Usage of My TaurusDB Instance Is High?
- How Do I Handle Slow SQL Statements Caused by Inappropriate Composite Index Settings?
- How Do I Handle a Large Number of Temporary Tables Being Generated for Long Transactions and High Memory Usage?
- What Should I Do If Locks on Long Transactions Block the Execution of Subsequent Transactions?
- How Can I Use Temporary Disks of TaurusDB?
- What Is the CPU Usage of a TaurusDB Instance with Empty Load?
-
Database Usage
- Why Are the Results Inconsistent After the MATCH AGAINST Statement Is Executed, Respectively, on Primary Nods and Read Replicas?
- How Do I Add Columns Using INSTANT?
- How Do I Use LOAD DATA to Import Local Data?
- How Do I Write Data to or Create Indexes for an Ultra-large Table?
- What Are the Risks of Deleting an Index from an Ultra-large Table?
- Backups
-
Database Parameter Modification
- How Do I Change the Time Zone of a TaurusDB Instance?
- How Do I Configure a Password Expiration Policy for TaurusDB Instances?
- How Do I Ensure that the Database Character Set of a TaurusDB Instance Is Correct?
- How Do I Use the utf8mb4 Character Set to Store Emojis in a TaurusDB Instance?
- How Do I Set Case Sensitivity for TaurusDB Table Names?
- Can I Use SQL Commands to Modify Global Parameters of My TaurusDB Instance?
- Network Security
-
Log Management
- Can I Enable general_log for TaurusDB?
- How Do I View All SQL Statements Executed by TaurusDB?
- How Do I Enable and View Binlog of My TaurusDB Instance?
- How Do I Change the Binlog Retention Period?
- How Do I View Deadlock Logs of TaurusDB?
- Why Are Slow SQL Statements Displayed in Slow Query Log Monitoring, but No Information About Them Is Displayed on the Slow Query Logs Tab Page in the Logs Module?
- Version Upgrade
-
Troubleshooting
-
Backup and Restoration Issues
- Insufficient Permissions During Data Export Using mysqldump
- How Do I use mysqlbinlog to Obtain Binlog Files?
- Canal Fails to Parse Binlogs
- Precautions for Exporting Large Tables Through mysqldump
- Commands for Exporting Data Through mysqldump
- System Inaccessible After Field Addition to a Database Table
- SQL Statements Such as SET @@SESSION.SQL_LOG_BIN Displayed After You Run mysqldump
- Insufficient Privileges Reported for Canal
-
Connection Issues
- Login Failed After ssl_type of root Is Changed to ANY
- Failed to Connect to a DB Instance Using SSL
- Description of Each IP Address
- SSL Connection Failed Due to Inconsistent TLS Versions
- Error Message "connection established slowly"
- "Access denied" Displayed During Database Connection
- Failed to Connect to a Database Using mariadb-connector in SSL Mode
- Failed to Connect to a Database as User root
- Client Automatically Disconnected from a DB Instance
- Disconnection Occurs Every 45 Days Due to the istio-citadel Certificate Mechanism
-
SQL Issues
- Invalid TIMESTAMP Default Value during Table Creation
- Failed to Change the VARCHAR Length Due to the Index Length Limit
- Slow SQL Queries After a Large Amount of Data Is Deleted from a Large Table
- Error 1366 Reported When Data Containing Emojis Is Updated
- Slow Stored Procedure Execution Due to Inconsistent Collations
- ERROR [1412] Reported for a DB Instance
- Failed to Delete a Table with a Foreign Key
- Incorrect GROUP_CONCAT Results
- Error Message "Too many keys specified" Displayed When a Secondary Index Is Created
- DISTINCT and GROUP BY Optimization
- Equivalent Comparison Failures with Floating-Point Numbers
- A Large Number of SELECT Requests Routed to The Primary Instance After Database Proxy Is Enabled
- Tablespace Bloat
- ERROR 1396 Reported When a User Is Created
- Error Message Reported When alter table xxx discard/import tablespace Is Executed
- Native Error 1461 Reported by a DB Instance
- "Row size too large" Reported When a Table Failed to Be Created
- Duplicate Data Exists After ORDER BY LIMIT Is Executed
- Error Message Reported When select * from sys.innodb_lock_waits Is Executed
- Parameter-related Issues
-
Performance Issues
- High CPU Usage
- Out of Memory (OOM) Errors
- Tablespace Bloat
- Read Replica Uses Far More Storage Than the Primary Node
- Slow SQL Execution Due to Hot and Cold Data Problems
- Full Storage Caused by Complex Queries
- Slow Response Due to Deadlocks
- CPU Usage Increase
- CPU Resource Exhaustion Caused by Too Many Concurrent Slow Queries
-
Basic Issues
- How Do I View the Used Storage of My TaurusDB Instance?
- Renaming Databases and Tables
- Character Set and Collation Settings
- Auto-Increment Field Value Jump
- Starting Value and Increment of AUTO_INCREMENT
- Changing the AUTO_INCREMENT Value of a Table
- Failed to Insert Data Because Values for the Auto-increment Primary Key Field Reach the Upper Limit
- Auto-increment Field Values
- AUTO_INCREMENT Not Displayed in the Table Structure
- Impact of Creating an Empty Username
- No Scanned Rows Recorded in Slow Query Logs
- "handle_sync_msg_from_slave my_net_read error:-1" Displayed on the Error Logs Tab Page
- ERROR 1290 (HY000): The MySQL server is running with the --sql-replica-on option so it cannot execute this statement
-
Backup and Restoration Issues
- Videos
- General Reference
Copied.
Buying a DB Instance and Connecting to It Using the mysql Client
After buying a DB instance, you can connect to it using a Linux ECS with the mysql client installed over a private network. This section describes how to access a DB instance from an ECS using the mysql client.
Operation Process
Process |
Description |
---|---|
Sign up for a HUAWEI ID, enable Huawei Cloud services, make sure you have a valid payment method configured, create IAM users, and grant them specific TaurusDB permissions. |
|
Configure information required for instance creation. |
|
If you want to use the mysql client to connect to a DB instance, you need to prepare a server, install the mysql client on the server, and run the connection command. Purchase a Linux ECS that is in the same region and VPC as your DB instance. If you have purchased a Windows ECS, you can connect to the DB instance using MySQL-Front. For details, see Buying a DB Instance and Connecting to It Using MySQL-Front. |
|
Test the network connectivity between the ECS and the private IP address and port of the DB instance, and install the mysql client on the ECS. |
|
Use a command-line interface (CLI) to connect to the DB instance using the private IP address and port. |
Preparations
- Before buying a DB instance, sign up for a HUAWEI ID and enable Huawei Cloud services.
If you have enabled Huawei Cloud services, skip this step.
- For fine-grained permissions management on Huawei Cloud resources, use Identity and Access Management (IAM) to create a user or user group and grant it specific operation permissions. For details, see Creating a User and Granting TaurusDB Permissions.
Procedure
Step 1: Buy a DB Instance
- Go to the Buy DB Instance page.
- On the Custom Config page, configure information about the instance and click Next.
- Basic configuration
Figure 1 Basic configuration
Table 1 Basic configuration Parameter
Example
Description
Billing Mode
Pay-per-use
Billing mode of an instance.
- Yearly/Monthly: A prepaid billing mode in which you pay for resources before using it. Bills are settled based on the subscription period. The longer the subscription, the bigger the discount. This mode is a good option for long-term, stable services.
- Pay-per-use: A postpaid billing mode. You pay as you go and just pay for what you use. The DB instance usage is calculated by the second but billed every hour. This mode allows you to adjust resource usage easily. You neither need to prepare for resources in advance, nor end up with excessive or insufficient preset resources.
- Serverless: The instance capacities automatically change based on application requirements. You can start using the DB instance first and then pay as you go.
Region
CN-Hong Kong
Region where an instance is deployed.
NOTE:
You cannot change the region of an instance once it is purchased.
- Resource selection
Figure 2 Resource selection
Table 2 Resource selection Parameter
Example
Description
DB Engine Version
TaurusDB V2.0
DB engine and version.
Kernel Version
2.0.60.241220
DB kernel version. For details about the updates in each minor kernel version, see TaurusDB Kernel Version Release History.
NOTE:
- To specify the kernel version when buying an instance, submit a request by choosing Service Tickets > Create Service Ticket in the upper right corner of the management console.
- To buy a multi-primary instance, select kernel version 2.0.45.230950 or 2.0.57.240900.
Creation Method
Create new
How an instance is created.
Edition Type
Enterprise
Enterprise Edition is an enterprise-grade cloud-native database with high scalability and performance. It is fully compatible with open-source MySQL 8.0. It decouples compute from storage and uses Huawei-developed Data Function Virtualization (DFV), which scales to up to 128 TB per instance. A failover can be complete within seconds. High-value capabilities such as read/write splitting, operator pushdown, a serverless framework, and HTAP are also supported. It provides the high availability and superior performance of a commercial database at the price of an open-source database.
DB Instance Type
Primary/Standby
A primary/standby instance can contain one primary node and 1 to 15 read replicas. The primary node processes read and write requests, and the read replicas process only read requests. If the primary node becomes unavailable, TaurusDB automatically fails over to a read replica. Primary/Standby instances apply to medium- and large-sized enterprises in the Internet, taxation, banking, and insurance sectors.
AZ Type
Multi-AZ
An AZ is a physical region where resources have their own independent power supply and networks. AZs are physically isolated but interconnected through an internal network. Some regions support both single-AZ and multi-AZ deployment and some only support single-AZ deployment.
- Single AZ: The primary node and read replicas are deployed in the same AZ.
- Multi-AZ: The primary node and read replicas are deployed in different AZs to achieve higher availability and reliability. It is suitable for workloads that require cross-AZ DR or are insensitive to cross-AZ latency.
Storage Type
DL6
The original Shared storage. The default storage type of TaurusDB instances created before July 2024 is Shared storage, while that of TaurusDB instances created in July 2024 and beyond is DL6.
DL6-based instances achieve zero RPO with a 3-AZ deployment and deliver better performance and higher peak throughput. They are suitable for core application systems that are sensitive to performance and have demanding requirements on storage I/O during peak hours, such as those in finance, e-commerce, government, and gaming.
- Instance options
Figure 3 Specifications and storage
Table 3 Specifications and storage Parameter
Example
Description
Instance Specifications
Dedicated
2 vCPUs | 4 GB
vCPUs and memory of an instance.
CPU Architecture
x86
x86 instances use Intel® Xeon® Scalable processors and feature robust and stable computing performance. When working on high-performance networks, the instances provide the additional performance and stability that enterprise-class applications demand.
Nodes
2
This parameter is mandatory for primary/standby and multi-primary instances.
Storage
-
It contains the system overhead required for inodes, reserved blocks, and database operations.
Backup Space
-
TaurusDB provides free backup space equal to the amount of your used storage. After the free backup space is used up, you will be billed for the additional space on a pay-per-use basis.
TDE
Disabled
Transparent Data Encryption (TDE) encrypts data files and backup files using certificates to implement real-time I/O encryption and decryption. This function effectively protects the security of databases and data files.
Figure 4 NetworkTable 4 Network Parameter
Example
Description
VPC
default_vpc
Virtual network in which your instance is located. A VPC can isolate networks for different workloads.
If no VPC is available, click Create VPC. After a VPC is created, click
. For details, see Creating a VPC and Subnet.
NOTICE:After a TaurusDB instance is created, the VPC cannot be changed.
Subnet
default_subnet
A subnet provides dedicated network resources that are logically isolated from other networks for network security.
Security Group
default
A security group enhances security by controlling access to TaurusDB from other services.
Figure 5 Setting an administrator passwordTable 5 Database configuration Parameter
Example
Description
DB Instance Name
TaurusDB-985e
DB instance name.
Administrator Password
-
The default administrator account is root.
The administrator password must consist of 8 to 32 characters and contain at least three of the following: uppercase letters, lowercase letters, digits, and special characters (~!@#%^*-_=+?,()&$|.). Enter a strong password and periodically change it to improve security and defend against threats such as brute force cracking attempts.
Keep this password secure. If lost, the system cannot retrieve it.
After a DB instance is created, you can reset this password. For details, see Resetting the Administrator Password.
Confirm Password
-
Enter the administrator password again.
- Advanced settings
Figure 6 Advanced settings and required quantity
Table 6 Advanced settings and required quantity Parameter
Example
Description
Enterprise Project
default
If your account has been associated with an enterprise project, select the target project from the Enterprise Project drop-down list.
For more information about enterprise projects, see Enterprise Management User Guide.
Parameter Template
Default-TaurusDB V2.0
Contains engine configuration values that can be applied to one or more instances.
Time Zone
-
You need to select a time zone for your instance based on the region hosting your instance. The time zone is selected during instance creation and cannot be changed after the instance is created.
Table Name
Case insensitive
Specifies whether table names are case sensitive. This option cannot be changed later.
- Case sensitive: Table names are case sensitive.
- Case insensitive: Table names are case insensitive and are stored in lowercase letters by default.
Tag
-
Tags a DB instance. This parameter is optional. Adding tags helps you better identify and manage your DB instances. Each DB instance can have up to 20 tags.
Quantity
1
You can buy DB instances in batches. The default value is 1. The value ranges from 1 to 10.
- Basic configuration
- Check the purchased DB instance.
- Click the DB instance name to go to the Basic Information page.
- In the Network Information area, obtain the private IP address and database port.
Figure 7 Viewing the private IP address and database port
Step 2: Buy an ECS
- Log in to the management console and check whether there is an ECS available.
- If there is a Linux ECS, go to 3.
- If there is a Windows ECS, see Buying a DB Instance and Connecting to It Using MySQL-Front.
- If no ECS is available, go to 2.
- Buy an ECS and select Linux (for example, CentOS) as its OS.
To download the mysql client to the ECS, bind an EIP to the ECS. The ECS must be in the same region, VPC, and security group as the DB instance for mutual communications.
For details about how to purchase a Linux ECS, see Purchasing an ECS in Elastic Cloud Server Getting Started.
- On the ECS Information page, view the region and VPC of the ECS.
Figure 8 Viewing ECS information
- On the Basic Information page of the DB instance, view the region and VPC of the DB instance.
Figure 9 Viewing the region and VPC of the DB instance
- Check whether the ECS and DB instance are in the same region and VPC.
- If they are in the same region and VPC, go to Step 3: Test Connectivity and Install the mysql Client.
- If they are in different regions, buy another ECS or DB instance. The ECS and DB instance in different regions cannot communicate with each other. To reduce network latency, deploy your DB instance in the region nearest to your workloads.
- If they are in different VPCs, change the VPC of the ECS to that of the DB instance. For details, see Changing a VPC.
Step 3: Test Connectivity and Install the mysql Client
- Log in to the ECS. For details, see Logging In to a Linux ECS Using VNC in Elastic Cloud Server User Guide.
- On the ECS, check whether it can connect to the DB instance using the private IP address and port obtained in 5.
telnet private_IP_address port
NOTE:
If the message "command not found" is displayed, install the Telnet tool based on the OS used by the ECS.
- If the ECS can connect to the DB instance, no further action is required.
- If the ECS cannot connect to the DB instance, check the security group rules.
- If in the security group associated with the ECS, there is no outbound rule with Destination set to 0.0.0.0/0 and Protocol & Port set to All, add the private IP address and port of the DB instance to the outbound rules.
- Add the private IP address and port of the ECS to the inbound rules in the security group associated with the DB instance.
- Download the mysql client installation package for the Linux ECS.
You are advised to use a mysql client running a version later than that of the DB instance.
wget https://dev.mysql.com/get/mysql-community-client-8.0.21-1.el6.x86_64.rpm
- Run the following command to install the mysql client:
rpm -ivh --nodeps mysql-community-client-8.0.21-1.el6.x86_64.rpm
NOTE:
- If any conflicts occur during the installation, add the replacefiles parameter to the command and install the client again.
rpm -ivh --replacefiles mysql-community-client-8.0.21-1.el6.x86_64.rpm
- If a message is displayed prompting you to install a dependency package during the installation, add the nodeps parameter to the command and install the client again.
rpm -ivh --nodeps mysql-community-client-8.0.21-1.el6.x86_64.rpm
- If any conflicts occur during the installation, add the replacefiles parameter to the command and install the client again.
Step 4: Connect to the DB Instance Using the mysql Client
- Run the following command on the ECS to connect to the DB instance:
mysql -h <host> -P <port> -u <userName> -p
Example:
mysql -h 192.*.*.* -P 3306 -u root -p
- Enter the password of the database account if the following information is displayed:
Enter password:
Figure 10 Connection succeeded - Create database db_test.
create database db_test;
Figure 11 Creating a database - Create table t_test.
create table t_test(id int(4), name char(20), age int(4));
Figure 12 Creating a table - Insert a data record into the table.
insert into t_test(id, name, age) values(1, 'zhangsan', 30);
Figure 13 Inserting data - Query data in the table.
Figure 14 Querying data
- Update the value of age for the data record whose id is 1 in the table.
update t_test set age=31 where id=1;
Figure 15 Updating data - Query the updated data in the table.
select * from t_test where id=1;
Figure 16 Querying the updated data - Delete the data record whose id is 1 from the table.
delete from t_test where id=1;
Figure 17 Deleting table data - Delete the table structure.
Figure 18 Deleting a table structure
- Delete the database.
Figure 19 Deleting a database
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