def _run_postgresql_commands(host, user, password, database):
    # Connect to postgresql and get cursor to run sql commands
    connection = psycopg2.connect(user=user, host=host, password=password, database=database)
    connection.set_session(autocommit=True)
    logger.warning('Successfully Connected to PostgreSQL.')
    cursor = connection.cursor()
    try:
        db_password = _create_db_password(database)
        cursor.execute("CREATE USER root WITH ENCRYPTED PASSWORD '{}'".format(db_password))
        logger.warning("Ran Database Query: `CREATE USER root WITH ENCRYPTED PASSWORD '%s'`", db_password)
    except psycopg2.ProgrammingError:
        pass
    cursor.execute("GRANT ALL PRIVILEGES ON DATABASE {} TO root".format(database))
    logger.warning("Ran Database Query: `GRANT ALL PRIVILEGES ON DATABASE %s TO root`", database)