By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,972 Members | 1,092 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,972 IT Pros & Developers. It's quick & easy.

getting started with v 7.4

P: 1
Hello,

I'm brand new to postgreSQL (I'm running v 7.4) and am working on porting a simple mySQL db to postgres, but I'm a unique (uniquely obnoxious) situation:

I'm not the one who installed postgresSQL on the server I'm working on, but the only way its been used in the past is via some GUI tool that does the heavy lifting for specific GIS applications. I, however, need to get right into the command-line application and create two simple applications, and then configure postgres to allow JDBC to manipulate my databases.

The person who installed postgres is long gone, and no one working here now has used it before without the GIS crutch I mentioned above...that's where you all come in.

I do have admin access on the server postgres is installed on. I tried running the command 'psql' only to recieve the following error:

Expand|Select|Wrap|Line Numbers
  1. no pg_hba.conf entry for host "[local]", user "root", database "root", SSL off
I managed to locate my pg_hba.conf file, the current contents of which are:

Expand|Select|Wrap|Line Numbers
  1. local all postgres ident sameuser
  2. host all all 127.0.0.1/32 md5
  3. host root root local
  4.  
The first three lines were there when I first opened the file and the last line was a feeble attempt on my part to fill in the missing entry the above error is complaining about.

My primary questions are:
-How can I modify my configuration appropriately and run postgreSQL from the command-line so I can create my databases?
-What is the correct syntax for running postgreSQL from the command-line?
-Is there any reason I would want to create a new user for me to use (rather than using 'root')? If so, how do I go about doing that?

Thank you very much in advance for your time and effort.
Dec 11 '07 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 700
Hello,

I'm brand new to postgreSQL (I'm running v 7.4) and am working on porting a simple mySQL db to postgres, but I'm a unique (uniquely obnoxious) situation:

I'm not the one who installed postgresSQL on the server I'm working on, but the only way its been used in the past is via some GUI tool that does the heavy lifting for specific GIS applications. I, however, need to get right into the command-line application and create two simple applications, and then configure postgres to allow JDBC to manipulate my databases.

The person who installed postgres is long gone, and no one working here now has used it before without the GIS crutch I mentioned above...that's where you all come in.

I do have admin access on the server postgres is installed on. I tried running the command 'psql' only to recieve the following error:

Expand|Select|Wrap|Line Numbers
  1. no pg_hba.conf entry for host "[local]", user "root", database "root", SSL off
I managed to locate my pg_hba.conf file, the current contents of which are:

Expand|Select|Wrap|Line Numbers
  1. local all postgres ident sameuser
  2. host all all 127.0.0.1/32 md5
  3. host root root local
  4.  
The first three lines were there when I first opened the file and the last line was a feeble attempt on my part to fill in the missing entry the above error is complaining about.

My primary questions are:
-How can I modify my configuration appropriately and run postgreSQL from the command-line so I can create my databases?
-What is the correct syntax for running postgreSQL from the command-line?
-Is there any reason I would want to create a new user for me to use (rather than using 'root')? If so, how do I go about doing that?

Thank you very much in advance for your time and effort.
ad 1.
change the first line in pg_hba.conf to
local all all trust (isn't very safe but you will be able do connect with server with any database login
There is an error in the 3-rd line (in host connections you must give na IP and mask).
By the way, it would be better, you look at postgres.org and see what the column in pg_hba.conf means

ad 2.
starting the server: pg_ctl start (if variable PGDATA is set)
connecting with server psql database_name

ad 3.
The database superuser is called postgres. Root isn't even a user of database, uless postgres change it. It's like with OS, be better to create ordinary user and work on his account.
(sorry for my poor english)
Dec 12 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.