How to Configure Cloud SQL Read Only User
You set up a cloud sql read only user by creating a database role with select rights. Then you grant this role to specific user accounts inside your database instance. Many teams skip this step and share the default admin account for daily debugging. That shortcut gives every developer the power to change or delete live data. Broad permissions also increase the risk of accidental table drops during routine checks. Setting up a dedicated read role stops users from running write queries. It forms
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You set up a cloud sql read only user by creating a database role with select rights. Then you grant this role to specific user accounts inside your database instance. Many teams skip this step and share the default admin account for daily debugging. That shortcut gives every developer the power to change or delete live data. Broad permissions also increase the risk of accidental table drops during routine checks. Setting up a dedicated read role stops users from running write queries. It forms the base of safe database management for growing engineering teams.
How a cloud sql read only user works in practice
Google Cloud SQL is a managed service with strict limits on top admin accounts. Customers cannot create or use database accounts with full superuser attributes. A Google system account holds the true superuser rights on the instance. Customers cannot delete or change these built-in system roles or users. Instead, the default admin account belongs to a special cloud superuser role. This role lets you create roles, create databases, and log in. You must set a password for the default admin account before logging in.
To build a cloud sql read only user, you first log in with that admin role. You create a new role that only has permission to connect and read tables. First, you grant connect rights on the target database to the new role. Next, you grant usage rights on the specific schema that holds your tables. Then you grant select rights on all current tables inside that schema. You also set default rights so the role can read future tables. Finally, you assign this read role to individual accounts for your team members.
What native read roles solve and what they miss
Native database roles do a good job of stopping accidental writes and deletes. A developer using a read account cannot drop a table or alter rows. This setup works well for reporting tools and basic data checks. Still, database roles only decide who can log in and which tables they can read. They do not inspect what individual queries do while they run in flight.
A read role still returns every column inside a permitted table by default. If a table holds emails, phone numbers, card numbers, or national IDs, queries return them. Anyone with read rights can pull thousands of sensitive customer records in seconds. Also, maintaining default table permissions across many schemas takes constant manual work. When engineers create new schemas, they often forget to update the read role rules. Teams end up managing dozens of static passwords and role grants across every database instance. You need a way to mask sensitive fields in results without rewriting database roles.
Read-Only Root Filesystem + User Provisioning (SCIM): architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Add runtime guardrails and masking beside your databases and APIs
Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits inline in the protocol beside the service as an open-source proxy, a sidecar for your database or API. On every production query an agent or human runs, hoop.dev decides whether to pass, mask, block, or escalate it for review.
Before a query runs, hoop.dev guardrails check the statement against your rules, an AI Analyzer you configure can score intent or hold risky calls for human approval, and hoop.dev data masking rewrites sensitive fields in responses in memory. Explore the MIT-licensed project on GitHub.
Frequently asked questions
Can I give a Cloud SQL user full PostgreSQL superuser rights?
No, Cloud SQL is a managed service and blocks access to true superuser attributes. You use the built-in cloud superuser role to manage roles, databases, and extensions instead.
Why can my new read user not see newly created tables?
Table grants only apply to tables that exist when you run the grant command. You must alter default privileges on the schema so future tables inherit read rights.
Does a read-only database role protect sensitive customer data?
No, a read role only blocks write operations like insert, update, and delete. Users can still query full tables containing emails, phone numbers, card numbers, and national IDs.
Related guides
In this post