OperationalError : FATAL: no pg_hba.conf entry for host “127.0.0.1”, user “fibzadmin”, database...
I have been struggling with this issue for a few days now. I have read numerous other SO threads and it seems like my django app is having difficulty connecting to the postgres database. I am not sure why that is happening though. I am hoping some of the experts out there can take a look and tell me why this might be happening. I have pasted some of my configuration here.
This is what my settings.py contains
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'fibz',
'USER':"fibzadmin",
"PASSWORD":"fibzadmin",
"HOST":"localhost",
"PORT":"5432",
}
}
This is what my pg_hba.conf and postgresql.conf look like
sudo vim /var/lib/pgsql9/data/pg_hba.conf
Output:
local all all trust
# IPv4 local connections:
host all power_user 0.0.0.0/0 md5
# IPv6 local connections:
host all other_user 0.0.0.0/0 md5
host all storageLoader 0.0.0.0/0 md5
host all all ::1/128 md5
following are the main uncommented lines
listen_addresses = '*'
port = 5432
max_connections = 100
and this is from the psql
(fibzVenv) [admin]$ sudo su - postgres
Last login: Fri Nov 23 07:13:53 UTC 2018 on pts/3
-bash-4.2$ psql -U postgres
psql (9.2.24)
Type "help" for help.
postgres=# du
List of roles
Role name | Attributes | Member of
------------+------------------------------------------------+-----------
postgres | Superuser, Create role, Create DB, Replication | {}
fibzadmin | | {}
postgres=# l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+------------+----------+-------------+-------------+---------------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
fibz | fibzadmin | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/fibzadmin +
| | | | | fibzadmin=CTc/fibzadmin
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
(4 rows)
Are there any suggestions on what I might be doing wrong or what I should be looking at ? This is happening on amazon linux its on the same instance.
python django postgresql devops
add a comment |
I have been struggling with this issue for a few days now. I have read numerous other SO threads and it seems like my django app is having difficulty connecting to the postgres database. I am not sure why that is happening though. I am hoping some of the experts out there can take a look and tell me why this might be happening. I have pasted some of my configuration here.
This is what my settings.py contains
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'fibz',
'USER':"fibzadmin",
"PASSWORD":"fibzadmin",
"HOST":"localhost",
"PORT":"5432",
}
}
This is what my pg_hba.conf and postgresql.conf look like
sudo vim /var/lib/pgsql9/data/pg_hba.conf
Output:
local all all trust
# IPv4 local connections:
host all power_user 0.0.0.0/0 md5
# IPv6 local connections:
host all other_user 0.0.0.0/0 md5
host all storageLoader 0.0.0.0/0 md5
host all all ::1/128 md5
following are the main uncommented lines
listen_addresses = '*'
port = 5432
max_connections = 100
and this is from the psql
(fibzVenv) [admin]$ sudo su - postgres
Last login: Fri Nov 23 07:13:53 UTC 2018 on pts/3
-bash-4.2$ psql -U postgres
psql (9.2.24)
Type "help" for help.
postgres=# du
List of roles
Role name | Attributes | Member of
------------+------------------------------------------------+-----------
postgres | Superuser, Create role, Create DB, Replication | {}
fibzadmin | | {}
postgres=# l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+------------+----------+-------------+-------------+---------------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
fibz | fibzadmin | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/fibzadmin +
| | | | | fibzadmin=CTc/fibzadmin
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
(4 rows)
Are there any suggestions on what I might be doing wrong or what I should be looking at ? This is happening on amazon linux its on the same instance.
python django postgresql devops
what's in the/etc/hosts
?
– Red Cricket
Nov 23 '18 at 7:53
Also shouldn'tENGINE
be set todjango.db.backends.postgresql
instead ofdjango.contrib.gis.db.backends.postgis
.
– Red Cricket
Nov 23 '18 at 7:57
No I am using postgis plugin instead of postgresql
– MistyD
Nov 23 '18 at 7:58
add a comment |
I have been struggling with this issue for a few days now. I have read numerous other SO threads and it seems like my django app is having difficulty connecting to the postgres database. I am not sure why that is happening though. I am hoping some of the experts out there can take a look and tell me why this might be happening. I have pasted some of my configuration here.
This is what my settings.py contains
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'fibz',
'USER':"fibzadmin",
"PASSWORD":"fibzadmin",
"HOST":"localhost",
"PORT":"5432",
}
}
This is what my pg_hba.conf and postgresql.conf look like
sudo vim /var/lib/pgsql9/data/pg_hba.conf
Output:
local all all trust
# IPv4 local connections:
host all power_user 0.0.0.0/0 md5
# IPv6 local connections:
host all other_user 0.0.0.0/0 md5
host all storageLoader 0.0.0.0/0 md5
host all all ::1/128 md5
following are the main uncommented lines
listen_addresses = '*'
port = 5432
max_connections = 100
and this is from the psql
(fibzVenv) [admin]$ sudo su - postgres
Last login: Fri Nov 23 07:13:53 UTC 2018 on pts/3
-bash-4.2$ psql -U postgres
psql (9.2.24)
Type "help" for help.
postgres=# du
List of roles
Role name | Attributes | Member of
------------+------------------------------------------------+-----------
postgres | Superuser, Create role, Create DB, Replication | {}
fibzadmin | | {}
postgres=# l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+------------+----------+-------------+-------------+---------------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
fibz | fibzadmin | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/fibzadmin +
| | | | | fibzadmin=CTc/fibzadmin
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
(4 rows)
Are there any suggestions on what I might be doing wrong or what I should be looking at ? This is happening on amazon linux its on the same instance.
python django postgresql devops
I have been struggling with this issue for a few days now. I have read numerous other SO threads and it seems like my django app is having difficulty connecting to the postgres database. I am not sure why that is happening though. I am hoping some of the experts out there can take a look and tell me why this might be happening. I have pasted some of my configuration here.
This is what my settings.py contains
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'fibz',
'USER':"fibzadmin",
"PASSWORD":"fibzadmin",
"HOST":"localhost",
"PORT":"5432",
}
}
This is what my pg_hba.conf and postgresql.conf look like
sudo vim /var/lib/pgsql9/data/pg_hba.conf
Output:
local all all trust
# IPv4 local connections:
host all power_user 0.0.0.0/0 md5
# IPv6 local connections:
host all other_user 0.0.0.0/0 md5
host all storageLoader 0.0.0.0/0 md5
host all all ::1/128 md5
following are the main uncommented lines
listen_addresses = '*'
port = 5432
max_connections = 100
and this is from the psql
(fibzVenv) [admin]$ sudo su - postgres
Last login: Fri Nov 23 07:13:53 UTC 2018 on pts/3
-bash-4.2$ psql -U postgres
psql (9.2.24)
Type "help" for help.
postgres=# du
List of roles
Role name | Attributes | Member of
------------+------------------------------------------------+-----------
postgres | Superuser, Create role, Create DB, Replication | {}
fibzadmin | | {}
postgres=# l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+------------+----------+-------------+-------------+---------------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
fibz | fibzadmin | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/fibzadmin +
| | | | | fibzadmin=CTc/fibzadmin
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
(4 rows)
Are there any suggestions on what I might be doing wrong or what I should be looking at ? This is happening on amazon linux its on the same instance.
python django postgresql devops
python django postgresql devops
asked Nov 23 '18 at 7:36
MistyDMistyD
4,0991470140
4,0991470140
what's in the/etc/hosts
?
– Red Cricket
Nov 23 '18 at 7:53
Also shouldn'tENGINE
be set todjango.db.backends.postgresql
instead ofdjango.contrib.gis.db.backends.postgis
.
– Red Cricket
Nov 23 '18 at 7:57
No I am using postgis plugin instead of postgresql
– MistyD
Nov 23 '18 at 7:58
add a comment |
what's in the/etc/hosts
?
– Red Cricket
Nov 23 '18 at 7:53
Also shouldn'tENGINE
be set todjango.db.backends.postgresql
instead ofdjango.contrib.gis.db.backends.postgis
.
– Red Cricket
Nov 23 '18 at 7:57
No I am using postgis plugin instead of postgresql
– MistyD
Nov 23 '18 at 7:58
what's in the
/etc/hosts
?– Red Cricket
Nov 23 '18 at 7:53
what's in the
/etc/hosts
?– Red Cricket
Nov 23 '18 at 7:53
Also shouldn't
ENGINE
be set to django.db.backends.postgresql
instead of django.contrib.gis.db.backends.postgis
.– Red Cricket
Nov 23 '18 at 7:57
Also shouldn't
ENGINE
be set to django.db.backends.postgresql
instead of django.contrib.gis.db.backends.postgis
.– Red Cricket
Nov 23 '18 at 7:57
No I am using postgis plugin instead of postgresql
– MistyD
Nov 23 '18 at 7:58
No I am using postgis plugin instead of postgresql
– MistyD
Nov 23 '18 at 7:58
add a comment |
1 Answer
1
active
oldest
votes
I think the error message is very accurate. Looking at your pg_hba.conf I don't see a line specifying fibzadmin
as a valid user except over ipv6.
I think you need to add the following line:
host all fibzadmin 0.0.0.0/0 md5
I am going to try this.
– MistyD
Nov 23 '18 at 7:45
after adding that I am getting the error FATAL: password authentication failed for user "fibzadmin". Is there a simple way for me to check if the password I specified is correct ?
– MistyD
Nov 23 '18 at 7:53
think you can assume thatpassword authentication failed
means the password you entered is incorrect. If you're testing things you could temperarely set the trust level astrust
so you can log in.
– Exelian
Nov 23 '18 at 8:19
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53442434%2foperationalerror-fatal-no-pg-hba-conf-entry-for-host-127-0-0-1-user-fibza%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I think the error message is very accurate. Looking at your pg_hba.conf I don't see a line specifying fibzadmin
as a valid user except over ipv6.
I think you need to add the following line:
host all fibzadmin 0.0.0.0/0 md5
I am going to try this.
– MistyD
Nov 23 '18 at 7:45
after adding that I am getting the error FATAL: password authentication failed for user "fibzadmin". Is there a simple way for me to check if the password I specified is correct ?
– MistyD
Nov 23 '18 at 7:53
think you can assume thatpassword authentication failed
means the password you entered is incorrect. If you're testing things you could temperarely set the trust level astrust
so you can log in.
– Exelian
Nov 23 '18 at 8:19
add a comment |
I think the error message is very accurate. Looking at your pg_hba.conf I don't see a line specifying fibzadmin
as a valid user except over ipv6.
I think you need to add the following line:
host all fibzadmin 0.0.0.0/0 md5
I am going to try this.
– MistyD
Nov 23 '18 at 7:45
after adding that I am getting the error FATAL: password authentication failed for user "fibzadmin". Is there a simple way for me to check if the password I specified is correct ?
– MistyD
Nov 23 '18 at 7:53
think you can assume thatpassword authentication failed
means the password you entered is incorrect. If you're testing things you could temperarely set the trust level astrust
so you can log in.
– Exelian
Nov 23 '18 at 8:19
add a comment |
I think the error message is very accurate. Looking at your pg_hba.conf I don't see a line specifying fibzadmin
as a valid user except over ipv6.
I think you need to add the following line:
host all fibzadmin 0.0.0.0/0 md5
I think the error message is very accurate. Looking at your pg_hba.conf I don't see a line specifying fibzadmin
as a valid user except over ipv6.
I think you need to add the following line:
host all fibzadmin 0.0.0.0/0 md5
edited Nov 23 '18 at 7:46
answered Nov 23 '18 at 7:44
ExelianExelian
3,7672237
3,7672237
I am going to try this.
– MistyD
Nov 23 '18 at 7:45
after adding that I am getting the error FATAL: password authentication failed for user "fibzadmin". Is there a simple way for me to check if the password I specified is correct ?
– MistyD
Nov 23 '18 at 7:53
think you can assume thatpassword authentication failed
means the password you entered is incorrect. If you're testing things you could temperarely set the trust level astrust
so you can log in.
– Exelian
Nov 23 '18 at 8:19
add a comment |
I am going to try this.
– MistyD
Nov 23 '18 at 7:45
after adding that I am getting the error FATAL: password authentication failed for user "fibzadmin". Is there a simple way for me to check if the password I specified is correct ?
– MistyD
Nov 23 '18 at 7:53
think you can assume thatpassword authentication failed
means the password you entered is incorrect. If you're testing things you could temperarely set the trust level astrust
so you can log in.
– Exelian
Nov 23 '18 at 8:19
I am going to try this.
– MistyD
Nov 23 '18 at 7:45
I am going to try this.
– MistyD
Nov 23 '18 at 7:45
after adding that I am getting the error FATAL: password authentication failed for user "fibzadmin". Is there a simple way for me to check if the password I specified is correct ?
– MistyD
Nov 23 '18 at 7:53
after adding that I am getting the error FATAL: password authentication failed for user "fibzadmin". Is there a simple way for me to check if the password I specified is correct ?
– MistyD
Nov 23 '18 at 7:53
think you can assume that
password authentication failed
means the password you entered is incorrect. If you're testing things you could temperarely set the trust level as trust
so you can log in.– Exelian
Nov 23 '18 at 8:19
think you can assume that
password authentication failed
means the password you entered is incorrect. If you're testing things you could temperarely set the trust level as trust
so you can log in.– Exelian
Nov 23 '18 at 8:19
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53442434%2foperationalerror-fatal-no-pg-hba-conf-entry-for-host-127-0-0-1-user-fibza%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
what's in the
/etc/hosts
?– Red Cricket
Nov 23 '18 at 7:53
Also shouldn't
ENGINE
be set todjango.db.backends.postgresql
instead ofdjango.contrib.gis.db.backends.postgis
.– Red Cricket
Nov 23 '18 at 7:57
No I am using postgis plugin instead of postgresql
– MistyD
Nov 23 '18 at 7:58