Reputation: 821
I followed the installation on this document http://www.postgresql.org/download/linux/ubuntu/ and every thing seems to be fine. But when I try to this follow this tutorial: http://www.postgresql.org/docs/9.3/static/tutorial-createdb.html, everything is not fine any more. This is the error I got when I try to create a database table:
$ createdb mydb
WARNING: password file "/home/.../.pgpass" has group or world access; permissions should be u=rw (0600) or less
WARNING: password file "/home/.../.pgpass" has group or world access; permissions should be u=rw (0600) or less
createdb: could not connect to database template1: FATAL: role "..." does not exist
$ /usr/local/pgsql/bin/createdb mydb
bash: /usr/local/pgsql/bin/createdb: No such file or directory
Upvotes: 6
Views: 6708
Reputation: 423
You got one warning and one error.
You can handle the warning by this command of line in your terminal:
$ chmod 600 ~/.pgpass
When you write "psql" in your terminal, Postgres DBMS try to connect to the one database with your computer name but it can't find it. In other hand Postgrest create a database named "postgres" when it install so try connect to this and create your database. You can connect to "postgres" database easily with this command:
$ psql postgres
If you get the "connections on Unix domain socket "/tmp/.s.PGSQL.5432"?" error start your database with this command:
$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
Check the result with this command:
$ pg_ctl -D /usr/local/var/postgres status
Upvotes: 12
Reputation: 324265
The error message tells you what's wrong. Change the permissions on .pgpass
:
chmod u=rw $HOME/.pgpass
Also, unless you edited the error message and didn't say so, you appear to actually be attempting to connect as user ...
. I imagine the examples you read said something like:
psql -U "..." template1
and assumed you'd replace "..." with the actual username.
Upvotes: 2