PostgreSQL Configuration

  1. Make new Database and remember the Database name for future use.
    Table 1. PostgreSQL Configuration
    Command sudo -u postgres createdb <Database name>
    Eg: sudo -u postgres createdb aexdb
  2. Transfer ownership of the database to this user
    Table 2. Database Details
    Command sudo -u postgres psql -c "ALTER DATABASE <Database name> OWNER TO <Username of DB>;"
    Eg: sudo -u postgres psql -c "ALTER DATABASE aexdb OWNER TO aexpguser;"
  3. Grant all permissions (Safety step)
    Table 3. PostgreSQL Configuration (Cont.)
    Command sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE <Database name> TO <Username of DB>;"
    Eg: sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE aexdb TO aexpguser;"
  4. Confirm
Table 4. PostgreSQL Configuration (Cont.)
Command sudo -u postgres psql -l | grep <Database name>
Eg: sudo -u postgres psql -l | grep aexdb