Skip to content

Instantly share code, notes, and snippets.

@davetapley
Created April 24, 2013 01:05
Show Gist options
  • Save davetapley/5448794 to your computer and use it in GitHub Desktop.
Save davetapley/5448794 to your computer and use it in GitHub Desktop.
PostgreSQL roles issue on Ubuntu 10.04
vagrant@heroku:~$ sudo su postgres
$ psql
psql (9.1.9)
Type "help" for help.
postgres=# SELECT rolname FROM pg_roles;
rolname
----------
postgres
vagrant
(2 rows)
postgres=# \q
could not save history to file "/home/postgres/.psql_history": No such file or directory
$
vagrant@heroku:~$ psql
psql: FATAL: database "vagrant" does not exist
@davetapley
Copy link
Author

pg_hba.conf:

# Database administrative login by Unix domain socket
local   all             postgres                                peer

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5

@davetapley
Copy link
Author

Confirmed I have a DB for vagrant:

postgres=# \list
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 vagrant   | vagrant  | UTF8     | en_US.UTF-8 | en_US.UTF-8 |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment