Error connecting to PGSQL database in Joomla - postgresql

I am trying to install Joomla using Postgres and in the installer I have the following error:
Could not connect to the database. Connector returned number: Error connecting to PGSQL database.
This isn't telling me very much. Any ideas?

Unfortunately the installer does not return the real error.
Here are some general tips:
make sure the provided database already exists
check if your database needs some specific settings, such as a different port or sslmode=require
Put your connection details in a normal php file and run the script, having error reporting enabled:
<?php
$connection = 'host=127.0.0.1 port=5432 dbname=joomla3 user=postgres password=postgres';
$dbconn = pg_connect($connection);
var_dump($dbconn);
When running the script you might get a proper error. When you get a resource, the connection is successful: resource(4) of type (pgsql link)

Check selinux configuration:
$ sudo setenforce Permissive
and try again. If it works you can disable selinux at /etc/selinux/config and change the line
SELINUX=enforcing
by
SELINUX=permissive

Related

Strapi instalation has error: connect ECONNREFUSED 127.0.0.1:5432

I just install Strapi but with PostgreQL DB (not using -- quickstart which means SQLite)
1. yarn create strap'-app name-of-my-project,
2. submit all QA=default step-by-step (database=strapi, port=default, login/password nothing fancy, and last without SSL connection)
And the finall result is not so descriptive. Only server error with connecting, which I don't know
Connection test failed: connect ECONNREFUSED 127.0.0.1:5433
Problem solved! (after 2 hours of trying instalation)
The answer is => You have to install PostgreSQL DB too on your computer
Once its done, next, you can run Strapi by yarn develop
So the problem is solved. Other problem in meantime solved
`Server wasn't able to start properly. Error: The server does not support SSL connections. Try to install without SSL connection (last question in Strapi install process)
I know you resolved the issue but just posting this in case anybody needs specific instructions.
I followed this tutorial and it's working for me now.
Sidenote: Once I installed Postgres and ran the command psql postgres it prompted me to enter my password. Despite putting in the correct password it still gave me an error that it is the wrong password, so I ran psql postgres postgres and then entering my password resolved the issue for me.
Instead of downloading postgres you can apply docker and it works the same
Link: https://blog.dehlin.dev/docker-with-strapi-v4
I had the same problem and as Kris says above, you need to install postgresql, pgAdmin and create the database first to then can create your Strapi project linked to you database.
I followed this youtube tutorial (in spanish) to solve it very easy.
Also need to avoid enable SSL for your local project. If you need to change this option in the future you can make it in the strapi config/database.js file.
Good luck!

postgreSQl 12 with GSSAPI authenticate

I have been setup an authentication with Postgresql 12 using gssAPI on centos.I follow an example :https://paquier.xyz/manuals/postgresql/kerberos/ .But when i finish and run to conect with gssapi:
"psql -U "postgres/myrealm.example#MYREALM.EXAMPLE" -h myrealm.example postgres"
and i met an error :
psql: FATAL: could not accept GSSAPI security context
FATAL: accepting GSS security context failed
DETAIL: Unspecified GSS failure. Minor code may provide more information: Key table entry not found
I want to know if I'm missing any configuration steps/commands or implementing something wrong.Any kind help is highly appreciated. Thanks in advance.
Reason for problem
I ran into this same issue and spent a couple days debugging it. The issue ended up being that PostgreSQL was not configured to use the keytab that I thought I was using.
I had tried putting my keytab in the following locations:
/etc/krb5.keytab
/usr/local/pgsql/etc/krb5.keytab
And I tried setting the following in /var/lib/postgresql/data/postgresql.conf:
krb_server_keyfile = /etc/krb5.keytab
This should have worked, but I think because I was using PostgreSQL through a Docker container, the config wasn't being honored properly. I also tried doing a SHOW ALL query which also showed the expected entry of krb_server_keyfile = /etc/krb5.keytab
Solution
Finally, I set the environment variable KRB5_KTNAME=/etc/krb5.keytab and then my keytab got used.

Firebird 3 on macOS, local connection fails with: Can not access lock files directory /tmp/firebird/

I've installed firebird 3.0 from the package provided by firebirdsql.org.
If I try to use a local connection to a database:
isql employee -user SYSDBA
it fails with:
Can not access lock files directory /tmp/firebird/
So adding read/write/execute permissions to /tmp/firebird/
sudo chmod a+rwx /tmp/firebird/
and executing the command again yields:
Statement failed, SQLSTATE = 08001
I/O error during "open" operation for file "/tmp/firebird/fb_init"
-Error while trying to open file
-Unknown error: -1
This all will work if I sudo the calls, but is this really necessary?
What is the correct way to use a local connection to firebird database on macOS?
I found CORE-3871 issue in the firebird issue tracker, which describes the problem and it's solution. The user which tries to open the local connection must be member of the firebird user group.
So a user is added to the firebird group on mac bash with the following command:
sudo dseditgroup -o edit -a myusername -t user firebird
If you try to open the sample database employee, shipped with firebird, it's also necessary to grant the group write access to the employee.fdb:
sudo chmod g+w /Library/Frameworks/Firebird.framework/Resources/examples/empbuild/employee.fdb
Now /Library/Frameworks/Firebird.framework/Resources/bin/isql employee -user SYSDBA should work
I only put -p and the password and it's just fine. It's working.
You current command creates the Firebird Embedded database engine to connect to the database. To be able to do that, your current OS user needs to have sufficient access to the database file. For details how to fix that, see the answer by jonjonas68.
An alternative to solution - if you have the Firebird server running - is to connect through the Firebird server process, for example using isql localhost:employee -user sysdba -password <sysdbapassword>. Then the file permissions of the user running the Firebird server process will be applied. However, in that situation, you will need to specify a password when connecting, as passwordless authentication is only applied for Firebird Embedded connections.

Password authentication fails when trying to connect to postgresql from clojure with jdbc

I'm learning web development in Clojure and I'm not at all an expert in either PostgreSQL or JDBC.
I'm going through the "Web development with Clojure" book and I'm stuck because I cannot connect to a PostgreSQL database, although I believe I have followed the tutorial step by step.
I connected to psql with
sudo -u postgres psql
Then I created an admin user with password 'admin'
postgres=# CREATE USER admin WITH PASSWORD 'admin';
CREATE ROLE
Then I created a database named reporting :
postgres=# CREATE DATABASE reporting OWNER admin;
CREATE DATABASE
No complaints so far.
Then from my clojure code, I attempt to connect to the database and create a table :
(ns reporting-example.models.db
(:require [clojure.java.jdbc :as sql]))
;defining the db connection
(def db
{:subprotocol "postgresql"
:subname "//localhost/reporting"
:user "admin"
:password "admin"})
;function for creating an 'employee' table
(defn create-employee-table []
(sql/create-table :employee
[:name "varchar(50)"]
[:occupation "varchar(50)"]
[:place "varchar(50)"]
[:country "varchar(50)"])
)
; then trying to actually create the table, here's the part that breaks with an exception :
(sql/with-connection db
(create-employee-table))
And I'm getting an ugly :
org.postgresql.util.PSQLException: FATAL: password authentication failed for user "admin"
Which does not make sense to me, the credentials seem fine.
I tried the above code from both the Counterclockwise REPL and the Leiningen REPL. I'm on Ubuntu 13.10, if that matters.
Could someone explain to me what I am doing wrong here?
Thanks in advance!
Since you can't connect with psql using the same settings there are really three possibilities:
wrong/typo'd password
wrong/typo'd username
you are not connecting to the same server as you created the account on.
To check the latter, connect however you did to create the account and then run
show port;
Make sure it is the same as what you specify in your app. That isn't perfect - two pg instances can share a port if one isn't listening on TCP/IP and has a different socket directory - but it is a good first test.
You should also examine the PostgreSQL server error logs, as they may contain more detailed information about the nature of the authentication failure.
If you have not tried this already, review your pg_hba.conf file. It will be named something like
/etc/postgresql/9.6/main/pg_hba.conf (Ubuntu 16.04)
/var/lib/pgsql/9.3/data/pg_hba.conf (Fedora 20);
You may have to use find / -name pg_hba.conf to locate it.
At the bottom of the file, change the METHOD values to trust for local testing (see postgres docs for full information). Restart postgres to ensure everything is started clean and the new params are read:
> sudo systemctl restart postgresql # ubuntu
Hopefully this will cure your woes. It solved my problems on Ubuntu/Fedora.

setup-database-server-with-postgresql-and-pgadmin3

We have set up postgres 9.0 on our new debian 6.0 server
We want to remotely connect to this database server.
We followed the steps in the below url
http://www.ubuntugeek.com/howto-setup-database-server-with-postgresql-and-pgadmin3.html
But when restart our database it thows the foloowing error
authentication option not in name=value format: sameuser
Any advice on how to access database server remotely using pgadmin 3 would be much appreciated
According to this link, there was changed format of configuration file pg_hba.conf. Remove, please, keyword sameuser from it.