Huawei Cloud Authorized Partner Huawei Cloud MySQL remote access setup

Huawei Cloud / 2026-04-26 16:38:20

Introduction: Remote Access to MySQL on Huawei Cloud (Without the Drama)

So you’ve got a MySQL instance on Huawei Cloud and you want to connect to it from somewhere else—maybe your laptop, your office network, or a server in another cloud. The good news: remote access is totally doable. The slightly less good news: it’s also one of those tasks where several small settings can all conspire to make you think, “Why won’t this work?”

In this guide, we’ll cover the setup in a clear, practical way. We’ll talk about the “big levers” that determine whether you can connect: network reachability (security group and firewall style controls), database-side permissions (users and privileges), and MySQL configuration (bind address and port behavior). And yes, we’ll also include a checklist for common mistakes—because nothing says “fun” like troubleshooting the same issue for three hours and realizing you forgot to open port 3306. Classic.

What You’re Actually Setting Up (Spoiler: It’s Not Just One Switch)

When you attempt to connect remotely to a MySQL database, there are typically four layers that must align:

  • 1) Network path: Your client must be able to reach the MySQL host’s IP and port over the network.
  • 2) Cloud security rules: Huawei Cloud security groups / access controls must allow inbound traffic to the MySQL port from your source IP or network.
  • 3) MySQL server listening behavior: MySQL must be configured to accept connections on the right network interface and port.
  • 4) MySQL user permissions: The MySQL account you use must be allowed to connect from the client’s host (or IP range) and must have appropriate privileges.

If any layer fails, the connection fails. The error message may be vague—like “can’t connect” or “timeout”—so the goal here is to systematically verify each layer.

Prerequisites: Gather These Before You Touch Anything

Huawei Cloud Authorized Partner Before you start clicking around, collect the essentials. Think of this as packing for a trip, except the trip is “making your database reachable.”

  • MySQL instance endpoint (hostname or IP)
  • MySQL port (usually 3306, but confirm)
  • Client source IP (the public IP of your laptop/server) or the source network you’ll use
  • MySQL credentials (existing admin/root or a privileged account)
  • Whether your MySQL is self-managed (on ECS) or a managed service (like a cloud database product)

Why mention managed vs self-managed? Because managed services often restrict direct editing of configuration files, and remote access is controlled primarily through service settings. Self-managed instances give you more freedom—but also more rope to trip over.

Step 1: Confirm Your Connectivity Baseline

Before changing anything, try a basic connectivity test from your client machine.

1.1 Check DNS/endpoint resolves correctly

If you’re using a hostname endpoint, confirm it resolves to an IP:

  • Windows: use nslookup
  • Linux/macOS: use dig or nslookup

If DNS resolution fails, you won’t reach the database no matter how good your MySQL user permissions are. (MySQL can’t authenticate you if it can’t even see your network request.)

1.2 Test port reachability

Use a port check tool (varies by OS):

  • Linux/macOS: nc -vz <host> <port> or telnet
  • Windows: PowerShell can attempt a TCP connection

If you get “timeout,” “connection refused,” or “no route,” the issue is likely network/security group related. If the port is reachable but MySQL authentication fails, then you’re past the network layer and must focus on MySQL user permissions and configuration.

Huawei Cloud Authorized Partner Step 2: Configure Network Access Rules on Huawei Cloud

On Huawei Cloud, remote database access is typically governed by security group rules or similar access control policies attached to the instance or network interface. Let’s treat this layer carefully, because exposing MySQL to the world is how you become a cybersecurity case study.

2.1 Identify the correct security boundary

Depending on your architecture, your MySQL instance may have:

  • An associated security group that controls inbound/outbound rules
  • Network ACLs or firewall policies
  • Virtual private network routing considerations

Your target is simple: allow inbound traffic to the MySQL port from your specific source IP (or a limited range). Not from “0.0.0.0/0” unless you enjoy living dangerously.

2.2 Add an inbound rule for the MySQL port

In the security group/access control settings, create an inbound rule:

  • Protocol: TCP
  • Port: 3306 (or your configured port)
  • Source: your client public IP (recommended) or your corporate IP range

If you’re connecting from a specific environment (e.g., a CI runner, a bastion host, or a VPN), restrict the source to that environment’s IP range.

2.3 Apply changes and wait a moment

Security rule changes sometimes take a short time to propagate. If you just added the rule and immediately test, you may hit a time window where it hasn’t fully applied yet. Yes, computers are fast—until they aren’t.

Step 3: Validate MySQL Server Listening Settings (Self-Managed Case)

If your MySQL runs on a self-managed server (for example, an ECS instance), you must ensure MySQL listens on the right interface. Managed database services often handle this for you and focus on user/network settings.

3.1 Check bind-address

In MySQL configuration, the key directive is commonly bind-address. If it’s set to 127.0.0.1, MySQL listens only locally. Remote connections will fail even if the network port is open.

Typical safe remote listening options:

  • Set bind-address to the server’s private IP (preferred if you know you’re connecting within a VPC)
  • Or set it to 0.0.0.0 if you truly need it on all interfaces (less precise)

After changing configuration, restart the MySQL service.

Huawei Cloud Authorized Partner 3.2 Confirm MySQL is running and port is open locally

On the server, verify:

  • MySQL process is running
  • The port is listening (use tools like ss or netstat)

If you can’t confirm local listening, there’s no point in tuning security groups further. You’ll be steering a ship that isn’t afloat.

Step 4: Create/Update a MySQL User for Remote Access

Now we switch from network to database permissions. This is where many “it connects but still fails” stories begin.

4.1 Understand the MySQL account format

MySQL accounts include both username and host part. For example:

  • 'admin'@'localhost'
  • 'admin'@'10.0.0.%'
  • 'admin'@'192.168.1.50'

A user created for 'user'@'localhost' cannot necessarily connect from your client IP. MySQL doesn’t care that you typed the password correctly if it thinks the connection is coming from the wrong place.

4.2 Create a user bound to your client IP

On the MySQL server, connect using an admin account and run a query like:

CREATE USER 'remote_user'@'your_client_public_ip' IDENTIFIED BY 'a-strong-password';

Replace your_client_public_ip with your actual IP, such as 203.0.113.10.

If your client uses a stable corporate NAT IP, use that NAT IP. If your client IP changes frequently (dynamic IP), consider using a VPN with a stable exit node. Otherwise, you’ll keep updating accounts and passwords like it’s a never-ending subscription service.

4.3 Grant privileges on the specific database(s)

A safer approach is granting only what you need:

GRANT SELECT, INSERT, UPDATE, DELETE ON your_database.* TO 'remote_user'@'your_client_public_ip';

If you truly need broader rights, be explicit—but try not to grant ALL PRIVILEGES by default. Over-privileged accounts are convenient until they aren’t.

4.4 Apply privilege changes

Huawei Cloud Authorized Partner Depending on MySQL version/config, privileges may apply immediately after GRANT, but it’s common to run:

FLUSH PRIVILEGES;

Step 5: Confirm Remote Authentication Works

At this point, you should be able to connect from your client. Try using the MySQL client:

mysql -h <mysql_endpoint> -P <port> -u remote_user -p

If it connects but you get authentication errors, double-check:

  • The username/password
  • The host portion in the MySQL user definition (exact IP vs wildcard)
  • That the user exists in mysql.user or via SELECT user, host FROM mysql.user;

Step 6: Secure the Connection (Because “Works” Isn’t the End)

Remote access should be treated like a door in your house. You don’t just install a lock and leave the key under the doormat. You add multiple layers.

6.1 Use IP restrictions instead of broad exposure

Restrict inbound to your specific client IP or trusted network range. This single habit dramatically improves safety.

6.2 Consider TLS/SSL for MySQL

MySQL connections can be encrypted using TLS. The exact steps depend on whether you’re using a managed service and which CA/cert setup is supported. In general, you’ll need to:

  • Ensure the MySQL server has TLS enabled
  • Provide client-side configuration to verify server identity

If you don’t know where to start, begin with enabling TLS on the server side (where supported), then test with a TLS-enabled MySQL client option.

6.3 Avoid root for remote usage

Use a dedicated user with least privilege. Root from anywhere is like giving your house key to a stranger who “seems nice.”

Common Problems (And How to Fix Them Fast)

Problem 1: Connection times out

Likely cause: network/security rules are blocking traffic or routing is incorrect.

  • Verify the security group inbound rule allows TCP to your MySQL port from your client IP
  • Confirm the instance’s IP endpoint is correct and reachable
  • Check whether you’re connecting through a VPN/bastion and whether the security rules match that source IP

Problem 2: “Host not allowed to connect” / authentication error

Likely cause: MySQL user host mismatch.

  • Confirm you created 'user'@'specific_ip' (or a matching wildcard like 'user'@'10.%')
  • Check whether you’re connecting from a different IP than you think (NAT surprises are real)

Problem 3: Connection refused

Likely cause: MySQL isn’t listening externally, or service isn’t running.

  • For self-managed instances, check bind-address and firewall rules on the server
  • Verify MySQL service status

Problem 4: Works from one machine but not another

Likely cause: different source IPs or different network paths.

  • Check the public IP your client uses (use an IP check tool)
  • Ensure Huawei Cloud security group allows that specific source

Huawei Cloud Authorized Partner A Practical Verification Checklist (Use This Before You Celebrate)

Here’s a quick “did we really set it up?” checklist:

  • Endpoint: MySQL hostname/IP is correct
  • Port: Using correct port (3306 or custom)
  • Network: Client can reach the host/port (no timeout)
  • Security group: Inbound TCP to MySQL port allowed from your client IP
  • MySQL listening (self-managed): binds to correct interface
  • MySQL user: user exists with matching host part
  • Privileges: user has needed rights on the target database
  • TLS (optional): encrypted connection if required

If any checkbox fails, treat it like a detective story: don’t guess—verify.

Extra Tips: Make Remote Access Less Painful Next Time

  • Document your allowed IPs: Write down the source IPs/ranges you opened so future you doesn’t wonder what happened.
  • Create a dedicated role/user: Use a non-root user for applications and keep privileges minimal.
  • Use a bastion/VPN approach: If you have many users or changing IPs, a controlled gateway is cleaner than constantly editing security rules.
  • Test with a minimal query: For example, run SELECT 1; first, then move to real queries after connectivity is proven.

Conclusion: Remote Access Achieved, Sanity Preserved

Setting up remote access to a Huawei Cloud MySQL database boils down to aligning network reachability, cloud access controls, MySQL server listening behavior (when applicable), and user permissions. Once you approach it layer by layer, the process stops feeling like black magic and starts feeling like… well, a checklist with results.

Now go ahead: open the port you need, grant only the permissions you should, and connect confidently. And remember—if you accidentally allowed access from everywhere, don’t panic. Just fix it. Preferably before someone else notices.

TelegramContact Us
CS ID
@cloudcup
TelegramSupport
CS ID
@yanhuacloud