1

I am unable to run psql with my normal Mac user account in Terminal session, although I can do it using the postgres service account). When I enter the command psql mydb and type my password, I get the following message:

WARNING: password file "/Users/beh/.pgpass" has group or world access; permissions should be u=rw (0600) or less

But I cannot find .pgpass.

How do I set up and add users to my PostgreSQL 9.1 database on Mac OS X 10.6.8?

1

1 Answer 1

1

The file .pgpass starts with a dot and therefore is hidden from view by default in most file managers, but you should be able to access it through Terminal. You probably don't need the .pgpass file, so it may be a good idea to delete it. If you do decide to keep it, edit the password file according to the documentation and run chmod 0600 ~/.pgpass to fix the permissions.

PostgreSQL user accounts are independent of the operating system, but remember that unless specified on the command line, psql will use the current user's system username as both the database name and PostgreSQL username; an error will occur if a database or user by this name does not exist on the database cluster. To add users, run psql as the postgres user, then use the CREATE ROLE or CREATE USER SQL commands. Unless the users will connect to the same database, you may want to create databases for each user to avoid errors.

3
  • Thank you for the response. I think my Mac is corrupted. Even after creating role, it will not allow me to login. I uninstall POSTGRESQL thinking it will get rid of user POSTGRES from MAC and I can start all over again. But when I try to create POSTGRES in system preferences accounts maintenance,it says user is already there even though I cannot see the user. I am using the Mac administrator account. What can I do to correct problem?
    – Cheng
    Commented Sep 10, 2012 at 20:58
  • Delete the postgres user using the userdel (or equivalent, if not available on your system) command on the Terminal, then delete the database cluster (stored in /usr/local/var/postgres by default) and reinstall PostgreSQL (which will automatically recreate the postgres account). If the database cluster is not automatically recreated, do so in the same location where it was deleted using the initdb command.
    – bwDraco
    Commented Sep 10, 2012 at 21:14
  • @Cheng: Click on the check below the up/down voting controls to accept this as the best answer, so that the community can see that the problem is solved.
    – bwDraco
    Commented Sep 12, 2012 at 22:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .