Back to controls

Ensure that MySql database instances do not allow root login from any Host

It is recommended that root access to a MySql Database Instance should be allowed only through specific white-listed trusted IPs.

Category

Controls

Low

Applies to

Google Cloud

Coverage

1 queries

Asset types

1 covered

Overview

It is recommended that root access to a MySql Database Instance should be allowed only through specific white-listed trusted IPs.

Rationale

When root access is allowed for any host, any host from authorized networks can attempt to authenticate to a MySql Database Instance using administrative privileges. To minimize attack surface root access can explicitly allowed from only trusted IPs (Hosts) to support database related administrative tasks.

Remediation guidance

Using Command-line

Note: We haven't come across any setting provided by Google cloud console or gcloud utility to update host for a root user. Below remediation uses MySQL client binary to set the host for root user. Similarly, for PostgreSQL instance:

  1. Login to MySql database instance from authorized network

mysql connect -u root [INSTANCE_ADRESS]

2. Set host for root user

```sql
UPDATE MySql.user SET Host=\[Host_name/IP\] WHERE User='root';

**Impact**

Only configured hosts will be able access MySQL database Instance with root privileges.

**Default Value**

By default, `root` access to MySql Database Instance is allowed for any Host. 

**References**

1. https://cloud.google.com/MySql/docs/MySql/create-manage-users

**Notes**

This recommendation is only applicable to MySQL database Instances. As of now for PostgreSQL, google cloud console/gcloud utility does not offer any relevant setting/option.

Apart from default `root` if there are any other database users with administrative privileges, those should be considered for this recommendation as well.

## Service-wide remediation

> **Recommended when many resources are affected:** fix the platform baseline first so new resources inherit the secure setting, then remediate the existing flagged resources in batches.

### Google Cloud
Use organization or folder policies where available, shared project templates, logs and alerting baselines, and IaC modules so new resources inherit the secure setting.

## Operational rollout

1. Fix the baseline first at the account, subscription, project, cluster, or tenant scope that owns this control.
2. Remediate the currently affected resources in batches, starting with internet-exposed and production assets.
3. Re-scan and track approved exceptions with an owner and expiry date.

Query logic

These are the stored checks tied to this control.

MySql database instances do not allow root login from any Host

Connectors

Google Cloud

Covered asset types

SQLUser

Expected check: eq []

sqlUsers(where:{name:"root"OR:[{host:"%"},{host:"0.0.0.0"},{host:""}]}){...AssetFragment}
Cyscale Logo
Cyscale is an agentless cloud-native application protection platform (CNAPP) that automates the contextual analysis of cloud misconfigurations, vulnerabilities, access, and data, to provide an accurate and actionable assessment of risk.

Stay connected

Receive new blog posts and product updates from Cyscale

By clicking Subscribe, I agree to Cyscale’s Privacy Policy


© 2026 Cyscale Limited

LinkedIn icon
Twitter icon
Facebook icon
crunch base icon
angel icon