June 27th, 2003, 07:41 PM
Postgres Setup Question
I'm in the process of installing Postgres 7.3.3 onto my Slackware system, but have some questions that I can't seem to find answers for in the manual.
I've been able to successfully compile the database and install it to get the server to run. I ran
initdb -D /usr/local/pgsql/data without errors. So from what I understand, the only account that I can log into the database with now is 'postgres', correct? Now, should the initdb script created an initial database for the postgres root user? Reason I ask is because I try to connect to the database as the postgres user:
[postgres /usr/local/pgsql/bin]$ ./psql
... and get this error:
psql: FATAL: Database 'postgres' does not exist in the system catalog.
I *can* create other databases using 'createdb' from the command-line and successfully log into those databases and do transactions... but I'm left wondering why a 'default' database for the user wasn't created... or does this even happen? Do I have to do it? Furthermore, can I assume that adding other user accounts to the database would have similar results?
Just looking for some clarification on this.
---| Edited 06/29/2003 |---------------------
I *think* I have solved the problem by running the 'createdb' script without any arguments. It seems to create a database for the 'current' user. Now, however, I hav another problem, but I'll post that to a new thread.
Last edited by coredumped; June 29th, 2003 at 05:43 AM.
July 31st, 2003, 08:56 PM
When you first install PostgreSQL, you need to login using the database "template1". Every other database created is modeled after that template database. Once your in you can create new databases, users, et cetera.
August 1st, 2003, 10:26 AM
Yup, dotcomguy is right, if you just wanna check if everything's working, as postgres do psql -d template1 and you should be able to connect fine.
If you'd like to add new users check the createuser script.
PostgreSQL, it's what's for dinner...
August 1st, 2003, 01:59 PM
Yes, 'psql' usually assumes two things, if you just run it without parameters:
1. You are logging into PostgreSQL as the same user you are running your command linefrom.
2. You are logging into a database with the same name as the user. This doesn't mean that a default database for the user was created.
So, in coredumped's case, it assumed user postgres, and a database named postgres, which didn't exist.
If you just want a different database, you don't even need the -d switch. 'psql your_db_name' is good enough.