Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Create USER / DBMS Postgres 9.1

$
0
0
Running on Postgres 9.1 Ubuntu 13.04.
New to Postgres, not to DBMS.

Also trying to see if there is a list of system defined privileges that I can refer to, such as in Oracle.

I log in as Postgres user: psql -h localhost -U postgres
and then I create a db and user and allow grants to the user like this:

create user import_dbms_user with password 'import_dbms';
create database import_dbms_db;
grant all privileges on database import_dbms_db to import_dbms_user;

\du shows:
import_dbms_user | | {}
postgres | Superuser, Create role, Create DB, Replication | {}

In the pg_hba.conf I set as:
# local DATABASE USER METHOD [OPTIONS]
local import_dbms_db import_dbms_user md5
and restart Postgres.

However when I try to run psql from the command line:
psql -h localhost -U import_dbms_user -WI enter password when prompted
Password for user import_dbms_user:
psql: FATAL: database "import_dbms_user" does not exist

But I get the error as above.

Trying to understand what I may be doing wrong.

Do I need to assign some kind of login role to import_dbms_user or such?

i assumed in the pg_hba.conf the line above is all I needed to log in locally?
local import_dbms_db import_dbms_user md5

And instead of local I would enter IP address of machine from which I would want to log in to the server?
192.168.1.10 import_dbms_db import_dbms_user md5

I am running on a VM and am trying to run some python scripts with psycopg2 to load some data.

So that script cannot log in either. Do I need to create any special role / privilege for that user to login from that script as well?

Thank you for your help!

Mono

Viewing all articles
Browse latest Browse all 13329

Trending Articles