[root@localhost3]# sudo su postgres
bash-4.2$ psql
psql (10.8)
Type "help" for help.
postgres=# ALTER USER postgres WITH PASSWORD 'postgres';
ALTER ROLE
postgres=# CREATE DATABASE ambari;
CREATE DATABASE
postgres=# CREATE USER ambari WITH PASSWORD 'ambari';
CREATE ROLE
postgres=# GRANT ALL PRIVILEGES ON DATABASE ambari TO ambari;
GRANT
postgres=# \connect ambari;
You are now connected to database "ambari" as user "postgres".
ambari=# CREATE SCHEMA ambari AUTHORIZATION ambari;
CREATE SCHEMA
ambari=# ALTER SCHEMA ambari OWNER TO ambari;
ALTER SCHEMA
ambari=# ALTER ROLE ambari SET search_path to 'ambari','public';
ALTER ROLE
postgres=# \q
bash-4.2$ exit
exit