6

I'm running Ubuntu 14.04 with Postgres 9.3, Python 3.0 and Django 1.7. When I try to debug my application from PyDev, I receive the following:

Creating test database for alias 'default'...
Got an error creating the test database: permission denied to create database

Oddly enough, I cannot login to user postgres from command line with the password originally created. I reset it once last night, and am still unable to do so.

My pg_hba.conf is as follows:

# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     postgres                                peer
#host    replication     postgres        127.0.0.1/32            md5
#host    replication     postgres        ::1/128                 md5
local all postgres peer
local all stbiuser md5
local all all md5

My settings.py is as follows:

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.postgresql_psycopg2',
    'NAME': 'db',
    'USER': 'user',
    'PASSWORD': 'mypass',
    'Host':'127.0.0.1',
    'PORT':'5432'
    }
}

How do I remedy the permission denied message? Are there any settings modifications that are required as well?

SidC
  • 201
  • 3
  • 7

1 Answers1

8

you user probably does not have permission to create a database, open a terminal and log into postgress as postgress and run the following

ALTER USER user CREATEDB;
Dr Manhattan
  • 191
  • 1
  • 3
  • You can also add the createdb permission when creating a user: su - postgres dropuser --if-exists user su - postgres createuser user --createdb – tbm May 12 '15 at 21:46