Failed to initialise Postgres DB cluster on windows - postgresql

I am beginning in postgresql, and I have this problem after installing it on windows. Any idea?

First Run the PostgreSQL installer using Adminitsrator

Related

How can I get list of postgres clusters in windows

I'm trying to get a list of my postgreSQL clusters on windows. In linux it seems you can run pg_lsclusters, but it seems to not be available on windows. Does anyone have any suggestions?
I'm running postgreSQL 11.

How to stop PGAdmin 4 auto detecting a ghost instance?

I had Postgresql 9.6 installed (on Windows 10) and did a complete uninstall including the data directory and all old copies of PgAdmin and there are no environment variables relating to this or any other old Postgres installation either.
I recently installed Postgresql 11 and PgAdmin 4 v3.6 using EnterpriseDB installer. When I run PgAdmin 4 it aurto detects a postgresql instance called 9.6 - though the details tell me it is actually my v11 instance with the same port number and password etc. The only difference is that it is pointing to the non-existent old data directory.
I have searched for a stray postgresql.conf file (and can't find one as it was in the deleted data directory!). As there is also no environment variables, no binaries and no data I can't understand how PgAdmin is auto detecting this ghost. Any suggestions on how to correct it?
EDIT:
I have tried deleting all cookies relating to PgAdmin and Postgresql in Chrome too - this had no effect
I have also double checked that there is no postgresql 9.6 service running (but that just confirms the above where PgAdmin tells me it is called 9.6 but actually is a v11 instance)
Try deleting pgAdmin4 config file pgadmin4.db located at %APPDATA%\pgAdmin\
Restart pgAdmin4 and check.

Upgrading from postgres-9.3 to postgres-9.5

I need to use the new jsonb field in postgres so I decided to upgrade to 9.5 in my ununtu 16.04 LTS. I followed this tutorial , but when it gets to the command pg_upgradecluster 9.3 main, I get the error that cluster configuration already exists. I checked other tutorials and found that I could get the list of clusters with pg_lsclusters. But the command always shows only the 9.3 cluster. Any attempt to create the 9.5 cluster always results to cluster configuration already exists. I purged the 9.5 and installed again multiple times but the same result. At last I decided to purge all the postgres installations I have after backing up my 9.3 cluster with pg_dumpall.
Now I have decided to install the 9.5 freshly but I still get the same thing. When I install pg_lsclusters shows nothing and after starting postgres psql always returns psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Right now I'm so tired and frustrated. Please if anyone has any possible solution or suggestion, help
The problem seemed to be from the version 9.5 in the postgres repositories. I installed 9.6 and everything worked like magic. Had I known there was a stable 9.6 earlier, I wouldn't have wasted 6 hours of my life in something I could have done for 10 minutes. Anyway, I'm happy I have have a working postgres with jsonb field

How to remove PostgreSQL as a service?

I have installed PostgreSQL 9.5 in my machine. But there is no UI for that. When I installed pgAdmin I can view the postsql as a service.
Can I remove this service and install as a server like other databases(sql server, my sql)?
You can use pgAdmin III developed for PostgreSQL User Interface Or use cmd its will work. See this thread

Prevent Postgres 9.2 from starting

I have upgraded from 9.2 to 9.3 successfully on ubuntu. However,
/etc/init.d/postgresql start
starts both 9.2 and 9.3
Although the above command can accept that the version number and successfully starts and stops each one, is there any method I can use to make this command start 9.3 only.
The reason is that, I am not able to reboot the system now, but I am afraid when it is rebooted both servers can start.
My short term solution is to adjust the port numbers to make my application use 9.3 database. However, I would like to learn about more permanent and robust solutions.
Thanks in advance,
Steve
Ubuntu uses pg_wrapper to manage PostgreSQL installs. See the Ubuntu PostgreSQL wiki page.
You'll want to pg_dropcluster the 9.2 cluster, if you wish to actually destroy the old data. Or un-install PostgreSQL 9.2. Or modify the config file (don't remember the name right now) in /etc/postgresql/9.2/ that controls whether Pg starts or not. It's called something like start.conf or pg_ctl.conf or something.
You may also want to reverse the configured ports so your new 9.3 runs on 5432 and your not-started-by-default 9.2 tuns on 5433. That is in postgresql.conf.
Steve Harman's response worked perfectly for me, too:
Thanks for the response. In the /etc/postgresql/9.2/main/ directory, there is start.conf. If you change the single line in that file from 'auto' to 'disabled' then, /etc/init.d/postgresql start will not start 9.2. – Steve Harman Jan 1 at 16:55
On the other hand, just fyi, the command output is that both versions of the server are starting (which is not true and is coming from the service starting scripts)
user#server:/etc/postgresql/9.3/main$ sudo service postgresql start
* Starting PostgreSQL 9.1 database server
...done.
* Starting PostgreSQL 9.3 database server
...done.