Code snippets : PostgreSQL : Add new superuser after PostgreSQL installation
After I instaled PostgreSQL on Amazon Linux AMI, first thing after database server was up and running I start thinking how to create user with administrative privileges, so I can access it using some management applications.
So, here is how to create superuser and set password, which will allow to access PostgreSQL using admin tools.
[root@ip-10-8-1-1 data]# su - postgres -bash-4.1$ createuser pgadmin Shall the new role be a superuser? (y/n) y -bash-4.1$ psql psql (9.1.5) Type "help" for help. postgres=# ALTER USER pgadmin WITH PASSWORD 'pwdaccess'; ALTER ROLE postgres=# \q -bash-4.1$
And now I can use pgadmin username with password pwdaccess to connect to PostgreSQL instance with management tools (for example pgAdmin3).