How to connect to the correct DB server if there are multiple PostgreSQL DB server running on the same host?

Hi:
      I have created a second database cluster on my linux host and started the DB server. Together with the another DB server installed earlier, I have two database server running on the same host with different port number.

     I tried to create DB in the second data directory, but it automatically created the DB in the first DB which was created much earlier.

     My question is how to utilize the second server and create DB.

BR
Xiaobei
kinna_giraffeAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
adrpoConnect With a Mentor Commented:

You use:
createdb -p port
http://www.postgresql.org/docs/8.2/static/app-createdb.html
Also when you start the second server you can give it:
-D /path/to /new/data/directory -p port
http://www.postgresql.org/docs/8.2/static/app-postgres.html

Cheers,
za-k/
0
 
TallBoyConnect With a Mentor Commented:
Another option is to use psql:

$ psql -p 1234 myacct
...
myacct=# CREATE DATABASE ...

("1234" is the port, and "myacct" is the user account that I created earlier)
0
All Courses

From novice to tech pro — start learning today.