You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Yugabyte SQL云集群中获取超级用户权限?

How to Get Superuser Privileges in YSQL for Yugabyte Free Cloud Cluster

Got it, let's break down how to get superuser access in YSQL for your Yugabyte Free Cloud cluster—this is a common point of confusion since YSQL and YCQL have separate permission systems.

Step 1: Connect using the default YSQL superuser yugabyte

The key here is that Yugabyte Free Cloud sets yugabyte as the default superuser for YSQL, not admin or postgres. You can connect to your cluster using ysqlsh with the connection details from your Yugabyte Cloud console (look for the "Connect" button for your cluster). The command will look something like this:

ysqlsh -h <your-cluster-hostname> -U yugabyte -d yugabyte -W

When prompted, enter the password you set when creating your cluster—this works for the yugabyte user by default.

Step 2: Grant superuser privileges to your desired user

Once you're logged in as yugabyte, you can elevate any existing user to superuser. For example, to give your admin account superuser access, run this SQL command:

ALTER ROLE admin WITH SUPERUSER;

To confirm the change, re-run your original role check query:

SELECT rolname, rolsuper, rolcanlogin FROM pg_roles;

You should now see t in the rolsuper column for the admin user.

Why your previous attempts didn't work

Let's clear up the issues you ran into:

  • The admin user you created during cluster setup is a regular login user by default in YSQL (unlike YCQL, where admin gets superuser permissions out of the box). That's why your initial pg_roles output showed rolsuper = f for admin.
  • The postgres user in Yugabyte Free Cloud isn't configured for password-based external access. The pg_hba.conf error you saw means external connections for postgres aren't allowed, and the user doesn't have a password set—so direct login won't work here.
  • YSQL and YCQL maintain separate permission systems in YugabyteDB, so superuser status in one doesn't carry over to the other. That's why you could get superuser access in YCQL but not YSQL initially.

内容的提问来源于stack exchange,提问作者Ayan Dhara

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.01 02:53:12