Dne 21.11.2011 02:44, Phoenix Kiula napsal(a):
> Thanks Tomas and everyone.
>
> I have the following passwords:
>
> 1. Pgbouncer.ini file
>
> [databases]
> MYDB = host=127.0.0.1 dbname=MYDB user=MYDB_MYDB client_encoding=utf8
> port=5432 password=='bypass'
>
>
> 2. In the auth_file (with auth_type set to "md5")
>
> auth_type = md5
> auth_file = /var/lib/pgsql/pgbouncer.txt
>
> Inside the auth_file:
> "me" "<an md5 string>"
>
>
> 3. In the PHP file where I need to call with pg_connect() function.
> This is the postgresql database user as usual.
>
> pg_connect("host=127.0.0.1 dbname=$db port=6432 user=$user password=$pass");
I guess the $user is 'me' (as stated in pgbouncer.txt) and the password
corresponds to pgbouncer.txt (i.e. when MD5-hashed the result is equal
to the value in the file).
> Questions:
>
> a. For #2, the pgbouncer password, do I need to create this "me" user
> somewhere, or just writing here in the auth_file is fine? I have not
> "created" this user anywhere else yet. Just written the user name and
> md5 of the password in the auth_file.
No. The user is "created" by listing the username/password in the auth_file.
> b. In the connection string in #3 above, I need to be mentioning the
> pgbouncer user name, right? Will the password then be md5 as in
> auth_file? Or nothing?
You need to put the pgbouncer user name (as listed in the auth_file).
The password has to be the actual value, not the hash. Otherwise it'd be
equal to auth_type=plain.
Tomáš