ProgrammingError: permission denied for relation postgres and django

时间:2016-10-20 13:16:58

标签: sql linux django database postgresql

This is what i have done

  1. I have configured django website on a linux server recently with a root user unfortunately
  2. Now i have created a normal user on linux server and moved the entire website to new user(adam)

I expect i have configured the postgres database when i am in root

But after moving to new user, i can't access some of my database tables and keep on getting the below error

ProgrammingError: permission denied for relation geoapp_zipcodes_us

Below are my django database settings

DATABASES = {
    'default': {
        'ENGINE': 'django.contrib.gis.db.backends.postgis',
        'USER': 'adam',
        'NAME': 'client',
        'PASSWORD': 'client',
        'HOST': 'localhost',
        'PORT': '5432',
    }
}

Note: The database id geo django spatial and very huge in gb's, so can'delete or recreate in this stage

I googled some posts and tried the below steps but din't worked out

client=> GRANT SELECT ON ALL TABLES IN SCHEMA public TO adam;
ERROR:  role "adam" does not exist

Can anyone please let me know how to remove the above permission denied for relation error ?

0 个答案:

没有答案