Not being able to create postgresql database even after the postgresql package is installed

Recently with a cPanel server, we had this issue of not being able to create postgresql database even after the postgresql package is installed and database server is running. Fixing of one issue lead to another there by needing to fix all the errors.

Cpanel::AdminBin::adminrun(postgres) set error in context postgres
[2010-01-16 12:24:18 -0500] warn [postgres::listdbs] Encountered error in postgres::listdbs: Error from postgres wrapper: PostgreSQL has not been configured by the administrator. Unable to locate pgpass file.


This was fixed by doing these,

Login to WHM => SQL Services => Postgres Config => Click on “Install Config”.
Login to WHM => SQL Services => Postgres Config => “Set a Postgresql password also”


No error in cPanel after doing above. However that followed by an issue of created DBs not being appeared in the List DB page of Postgresql databases. Went to shell. Logged in as root . Switched to postgres. “su – postgres” . Ran the command “psql” and then

-bash-3.2$ psql
Welcome to psql 8.1.18, the PostgreSQL interactive terminal.


Type: copyright for distribution terms
h for help with SQL commands
? for help with psql commands
g or terminate with semicolon to execute query
q to quit

postgres=# l
List of databases
Name | Owner | Encoding
-----------+----------+----------
postgres | postgres | UTF8
template0 | postgres | UTF8
template1 | postgres | UTF8
(3 rows)



postgres=# q

No DB was created. Checked the logs /usr/local/cpanel/logs/error_log and it had entries likeERROR: role “username” does not exist which meant, no roles to create the database.

cd /var/cpanel/users && for x in *; do su -c "createuser -S -D -R $x" postgres; done

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

 Cannot upload images to phpBB posts

The issue is mainly occurring due to the absence of some code. To fix this issue, do the...

 How to Change Your FTP Port

Lately FTP has been a problem for a lot of hosting providers. Especially since the recent influx...

 Child pid xxx exit signal Segmentation fault (11)

Sometimes apache is crashing and all or some PHP pages are showing blank when you browse it. Also...

 Mailman Error “Bug in Mailman version 2.1.11.cp3?

If you are getting following error when trying to modify mailinglist then execute following...

 How to stop generating core files

You may come across core files which gets generated within your accounts . The possible reason...