A place to breathe

Sunday, January 10, 2016

Unable to connect to PostgreSQL server

I recently installed PostgreSQL on my server and trying out their configurations. All these while, I just play with MySQL. For some reason, I decided to use PostgreSQL for my current project.

PostgreSQL come with a user called postgres . If you want to use it with PHP, you might end up using the following from its documentation:

$dbconn2 pg_connect("host=localhost port=5432 dbname=mary");


Bad news, it doesn't work on me.

pg_connect(): Unable to connect to PostgreSQL server: FATAL: Ident authentication failed for user

To fix the error, all you need to do is to omit the "host" and the port parameter so that you just use something like this:

$dbconn2 pg_connect("dbname=mary user=postgres password="yourpassword");







No comments:

About Me

I'm currently a software engineer. My specific interest is games and networking. I'm running software company called Nusantara Software.