Buying an RDS for MariaDB Instance and Connecting to It Using a MariaDB Client
After buying a DB instance, you can connect to it using a Linux ECS with a MariaDB client installed over a private network. This section describes how to access a DB instance from an ECS using a standard MariaDB 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 RDS permissions. |
|
|
Select required basic settings and additional options and buy an RDS for MariaDB instance. |
|
|
If you want to connect to a DB instance using a MariaDB client, you need to prepare a server, install the MariaDB 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. |
|
|
Test the network connectivity between the ECS and the floating IP address and port of the DB instance, and install a MariaDB client on the ECS. |
|
|
Step 4: Connect to the DB Instance Using a CLI (Non-SSL Connection) |
Use a command-line interface (CLI) to connect to the DB instance using the floating IP address and port. |
Preparations
- Sign up for a HUAWEI ID and enable Huawei Cloud services.
- Before purchasing DB instances, ensure that your account balance is sufficient. Top up your account if required.
- For fine-grained permissions management on Huawei Cloud resources, use Identity and Access Management (IAM) to create a user and user group and grant it specific operation permissions. For details, see Creating a User and Granting Permissions.
Step 1: Buy an RDS for MariaDB Instance
- Go to the Buy DB Instance page.
- On the Custom Config page, select a billing mode and configure information about your DB instance. Then, click Buy.
- Engine options
Figure 1 Basic information
Parameter
Example Value
Description
Region
CN-Hong Kong
The region where your resources are located.
NOTE:Products in different regions cannot communicate with each other through a private network. After a DB instance is created, the region cannot be changed. Therefore, exercise caution when selecting a region.
Billing Mode
Pay-per-use
The 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.
DB Engine
MariaDB
The DB engine of an instance.
DB Engine Version
10.5
For details, see DB Engines and Versions.
Supported DB engine versions may vary by region. For the actual options, see them on the console.
DB Instance Type
Primary/Standby
The architecture type of an instance.
- Primary/Standby: An HA architecture. In a primary/standby pair, each instance has the same instance class. When a primary instance is being created, a standby instance is provisioned along with it to provide data redundancy. The standby instance is invisible to you after being created.
- Single: A single-node architecture is less expensive than a primary/standby DB pair. It is only recommended for development and testing of microsites, and small and medium enterprises, or for learning about RDS.
Storage Type
Cloud SSD
The storage type determines the read/write speed of an instance. A higher maximum throughput enables faster I/O operations.
- Cloud SSD: cloud disks used to decouple storage from compute. The maximum throughput is 350 MB/s.
- Extreme SSD: The disks combine the 25GE network and RDMA technologies to provide you with up to 1,000 MB/s throughput per disk and sub-millisecond latency.
AZ
az1
An AZ is a physical region where resources have 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.
To achieve high reliability, RDS will automatically deploy your primary and standby instances in different physical servers even if you deploy them in the same AZ.
You can deploy your primary and standby instances in a single AZ or across AZs to achieve failover and high availability.
- Instance configuration
Figure 2 Instance configuration
Parameter
Example Value
Description
Instance Class
General-purpose | 2U | 4G
The vCPU and memory of an instance. Different instance classes support different numbers of database connections and maximum IOPS.
After a DB instance is created, you can change its vCPUs and memory.
Storage Space
40 GB
It contains the system overhead required for inodes, reserved blocks, and database operation.
Storage space can range in size from 40 GB to 4,000 GB and can be scaled up only by a multiple of 10 GB.
After a DB instance is created, you can scale up its storage space. For details, see Scaling Up Storage Space.
- Basic settings and connectivity
Figure 3 Basic settings and connectivity

Parameter
Example Value
Description
DB Instance Name
rds-1d43
Must start with a letter and consist of 4 to 64 characters. Only letters (case-sensitive), digits, hyphens (-), and underscores (_) are allowed.
- If you intend to buy multiple DB instances at a time, the allowed length for each instance name will change.
- If you create multiple DB instances at a time, their names will include a four-digit suffix. For example, if you specify instance here, the names will be instance-0001, instance-0002, and so on. If existing instances' suffixes have already reached up to 0010, the new instance names will start from instance-0011.
Administrator
root
The default login name for the database is root.
Administrator Password
****
Must consist of 8 to 32 characters and contain the following character types: uppercase letters, lowercase letters, digits, and special characters (~!@#$%^*-_=+?,()&). Enter a strong password and periodically change it for security reasons.
If the password you provide is regarded as a weak password by the system, you will be prompted to enter a stronger password.
Keep this password secure. 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
****
Must be the same as Administrator Password.
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.
VPC
default_vpc
The virtual network in which your instance is located. A VPC can isolate networks for different workloads. You can select an existing VPC or create a VPC. For details about how to create a VPC, see Creating a VPC and Subnet.
If no VPC is available, RDS allocates a VPC to you by default.
NOTICE:After a DB 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. Subnets are only valid within a specific AZ. Dynamic Host Configuration Protocol (DHCP) is enabled by default for subnets where you plan to create DB instances and cannot be disabled.
A floating IP address is automatically assigned when you create a DB instance. You can also enter an unused IPv4 IP address in the subnet CIDR block.
Security Group
default
Enhances security by controlling access to your DB instance from other services. A network access control list (ACL) can help control inbound and outbound traffic of subnets in your VPC. Ensure that the security group you select allows the client to access the DB instance.
If no security group is available or has been created, the system allocates a security group to you by default.
- Additional options
Parameter
Example Value
Description
Parameter Template
Default-MariaDB-10.5
Contains engine configuration values that can be applied to one or more DB instances. If you intend to create a primary/standby DB pair, they use the same parameter template. You can modify the instance parameters as required after the instance is created.
For details about how to modify parameters of a DB instance, see Modifying Instance Parameters.
Time Zone
Select a time zone as required.
You need to select a time zone for your instance based on the region hosting your instance. You can change the time zone after the DB instance is created.
Table Name
Case insensitive
Specifies whether table names are case sensitive.
NOTE:The case sensitivity of table names for created instances cannot be changed.
Tag
test
Tags an RDS instance. This parameter is optional. Adding tags to RDS instances helps you better identify and manage the DB instances. A maximum of 20 tags can be added for each DB instance.
If your organization has configured tag policies for RDS, add tags to DB instances based on the policies. If a tag does not comply with the policies, DB instance creation may fail. Contact your organization administrator to learn more about tag policies.
After a DB instance is created, you can view its tag details on the Tags page. For details, see Managing Tags.
Quantity
1
The number of instances to be created in a batch.
- Basic settings and connectivity
- Engine options
- Click Buy.
- Confirm the details, read and agree to the agreement, and click Submit. Go back to the Instances page and check for the purchased instance.
Figure 4 Instance successfully purchased
Step 2: Buy an ECS
- Go to the Elastic Cloud Server console.
- Check whether there is a Linux ECS.
- If yes, go to 3.
If the ECS image is CentOS, CentOS 7.4 64bit must be used.
- If no, purchase an ECS and select Linux (for example, CentOS 7.4 64bit) as its OS.
To download a MariaDB client to the ECS, bind an EIP to the ECS. The ECS must be in the same region, VPC, and security group as the RDS for MariaDB instance for mutual communications.
For details about how to purchase a Linux ECS, see Purchasing an ECS in Elastic Cloud Server User Guide.
Figure 5 ECS
- If yes, go to 3.
- Check whether the ECS and RDS for MariaDB instance are in the same region and VPC.
- ECS: Click the ECS name to go to the Summary page and find its VPC.
- RDS for MariaDB: Click the instance name to go to the Overview page and find its VPC.
- If they are not in the same region, buy another ECS. 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 a MariaDB Client
- Log in to the ECS. For details, see Logging In to a Linux ECS Using VNC in the Elastic Cloud Server User Guide.
- On the Instances page of the RDS console, check the floating IP address and database port of the DB instance.
Figure 6 Connection information
- On the ECS, check whether the floating IP address and database port obtained in 2 can be connected.
curl -kv Floating_IP_address:Port
Example:
curl -kv 192.168.230.249:3306
- If yes, network connectivity is normal.
Figure 7 Normal network connectivity
- If no, check the security group rules.
- Check the outbound rules of the ECS security group. By default, all outgoing network traffic is allowed.
- If in the security group of the DB instance, there is no inbound rule allowing the access from the private IP address and port of the ECS, add an inbound rule for the private IP address and port of the ECS. For details, see Configuring a Security Group Rule.
- If yes, network connectivity is normal.
- Install the MariaDB client for Linux to the ECS. For details about the installation methods for other OSs, see the official documentation.
yum install MariaDB-client
Figure 9 Installing a MariaDB client
A MariaDB client running a version later than that of the DB instance is recommended.
Step 4: Connect to the DB Instance Using a CLI (Non-SSL Connection)
- 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.168.230.249 -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 a database, for example, mydb.
create database mydb;
Figure 11 Creating a database
- Create a table, for example, my_table.
create table my_table(id int);
Figure 12 Creating a table
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
