cPanel, postgresql and a default database issue with 8.4.x versions of postgres

The issue was there, because customer wanted a latest version of Postgresql, latest than what cPanel support by default.

Issue reported in the phppGAdmin page was

FATAL:  password authentication failed for user "cPanel_username"
FATAL:  permission denied for database "template1"
DETAIL:  User does not have CONNECT privilege.

Solution

# su - postgres
-bash-3.2$ psql
psql (8.4.2)
Type "help" for help.

postgres=# alter user cPanel_username with password 'password_here';
ALTER ROLE
postgres=# alter user cPanelusername_username with password 'password_here';

Check for issues in /var/lib/pgsql/pgstartup.log . That is where postgreSQL throws out errors which will be helpful in debugging the issues.

In prior releases, template1 was used both as a default connection for utilities like createuser, and as a template for new databases. This caused CREATE DATABASE to sometimes fail, because a new database cannot be created if anyone else is in the template database. With this change, the default connection database is now postgres, meaning it is much less likely someone will be using template1 during CREATE DATABASE.

Also, do change the postgresql configuration file of cPanel installation, /usr/local/cpanel/base/3rdparty/phpPgAdmin/conf/config.inc.php

Look for

$conf['servers'][0]['defaultdb'] = 'template1';

and change it to

$conf['servers'][0]['defaultdb'] = 'postgres';

Don’t forget to chattr also. BTW now a days, cPanel is intelligent enough to detect and remove the chattrs also :D .

Related posts:

  1. Postgresql issues with a cPanel server
  2. PostgreSQL for the sage – Must know basics for the system administrators
  3. How would I see the available versions of cPanel and Apache in a cPanel installed server ?
  4. Applying wildcards in GRANT option of MySQL
  5. Howto enable access to whm, cpanel subdomains (proxy subdomains) in cPanel

Comment Form

About this blog

This blog, acts as a knowledge repository for the world and is unofficial! Anything we find interesting in the cyber world will go here. Most cases, this blog will reflect the happiness of our staff in reaching successful solution to an issue (s)he worked on. A reference for other fellow SAGEs who come across similar issues later