Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working in a RedHat 5 environment. I have the psql command, but am not sure what I need to do to make a database. My admin would probably be willing to put reasonable things on the computer, but ideally I'd like to be able to manage my own little databases on the side.

Information on how to make the database, and what is necessary to do so, would be greatly appreciated!

share|improve this question

migrated from Jun 12 '11 at 14:11

This question came from our site for professional and enthusiast programmers.

To clarify: there is no postgres instance running (this is where looking things up is difficult). Assume I am a user on a more or less clean linux install. I do have the psql and createdb command, but I want a local instance of postgres on which to use them I suppose. – A Question Asker Jun 9 '11 at 19:00

The simplest way to create a database is to issue the createdb command from your (bash?) prompt:

$ createdb mydatabasename

The man page for createdb should have more details.

This, of course, assumes that you have the appropriate database privileges.

share|improve this answer

You need create database privileges to do so. If you do:

psql -U postgres

And then:

create user foo with login;
create database bar owner foo;

And finally:

psql -U foo bar

If you cannot create a database from lack of permissions, you might want to look into creating a schema as a workaround.

share|improve this answer

Set up your own instance:

initdb -D ~/pgdata
postgres -D ~/pgdata --port=55555

You can tweak this a little to start automatically or in the background. See the documentation.

Then you can connect:

psql -d postgres -p 55555    
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.