Superuser is not generally available during use of the RDS, so we recommend that you create a user separately and manage the user's private space through schema when using the database.
Note: In this example, myuser is the management account created together with the instance, and newuser is the account to be created now.
Create a user with the logon permission.
CREATE USER newuser LOGIN PASSWORD ’password’;
Parameters are described as follows:
- USER: The user name to be created, for example, newuser
- password: The password corresponding to the user name, for example, password
Create a schema for the new user.
CREATE SCHEMA newuser;
GRANT newuser to myuser;
ALTER SCHEMA newuser OWNER TO newuser;
REVOKE newuser FROM myuser;
If newuser is not added to the myuser role before
ALTER SCHEMA newuser OWNER TO newuser, the following problem with permission occurs:
ERROR: must be member of role "newuser"
In consideration of security, please remove newuser from the myuser role to improve security after the authorization of OWNER is handled.
Use newuser to log on to the database.
psql -U newuser -h intranet4example.pg.rds.aliyuncs.com -p 3433 pg001
Password for user newuser:
psql.bin (9.4.4, server 9.4.1)
Type "help" for help.