Manually Remove The Postgres User You Should

Hi guys!

I wanted to install PokerTracker3, but the required PostgreSQL could not be installed because (apparently) it was installed before by another program...
So, when I start PokerTracker3, a PostgreSQL server window opens containing already filled in data about Server, Password etc...
When I press connect, the window 'PostgreSQL wasn't able to connect to this database. Please check configuration (or something like this)' appears.

When I press connect, the window 'PostgreSQL wasn't able to connect to this database. Please check configuration (or something like this)' appears. So I searched on the internet and found on one of the many support websites the instruction to unistall PostgreSQL, which I did, but apparently the account wasn't fully deleted, so the problem is.

So I searched on the internet and found on one of the many support websites the instruction to unistall PostgreSQL, which I did, but apparently the account wasn't fully deleted, so the problem is still there and I have no idea of how to get rid of it!

I would greatly appreciate your help, but I need very basic instructions since I have only very basic knowledge of computers in general...

Best, sebastian
___________________________________________________________
Neu: WEB.DE De-Mail - Einfach wie E-Mail, sicher wie ein Brief!
Jetzt De-Mail-Adresse reservieren: https://produkte.web.de/go/demail02

Summary: in this tutorial, you will learn how to delete existing database by using PostgreSQL DROP DATABASE statement.

Introduction to PostgreSQL DROP DATABASE statement

Once a database is no longer needed, you can delete it by using the DROP DATABASE statement. The following illustrates the syntax of the DROP DATABASE statement:

To delete a database:

  • Specify the name of the database that you want to delete after the DROP DATABASE clause.
  • Use IF EXISTS to prevent an error from removing a non-existent database. PostgreSQL will issue a notice instead.

The DROP DATABASE statement deletes catalog entries and data directory permanently. This action cannot be undone so you have to use it with caution.

Only the database owner can execute the DROP DATABASE statement. In addition, you cannot execute the DROP DATABASE statement if there is any active connection to the database. You have to connect to another database e.g., postgresqlto execute the DROP DATABASE statement.

PostgreSQL also provides a utility program named dropdbthat allows you to remove a database. The dropdbprogram executes the DROP DATABASE statement behind the scenes.

Delete a database that has active connections

To delete the database that still has active connections, you can follow the steps below:

First, find the activities that are taken place against the target database, you can query the pg_stat_activityview as the following query:

2
4
6
*
pg_stat_activity
datname='target_database';

Second, terminate the active connections by issuing the following query:

2
4
6
pg_terminate_backend(pg_stat_activity.pid)
pg_stat_activity
pg_stat_activity.datname='target_database';

Notice that if you use PostgreSQL version 9.1 or earlier, use the procpidcolumn instead of the pidcolumn because PostgreSQL changed procidcolumn to pidcolumn since version 9.2

Third, execute the DROP DATABASE statement:

PostgreSQL DROP DATABASE examples

We will use the databases created in the PostgreSQL create database tutorial for the demonstration. If you don’t have these databases available, you can create them by executing the following statements:

2
CREATEDATABASEtestdb1;

Delete database that has no active connection example

To remove the hrdbdatabase, use the hrdb owner to connect to a database other than hrdbdatabase e.g., postgres and issue the following statement:

PostgreSQL deleted the hrdbdatabase.

Delete database that has active connections example

The following statement deletes the testdb1database:

Manually Remove The Postgres User You Should Take

However, PostgreSQL issued an error as follows:

2
ERROR:database'testdb1'isbeing accessed by other users
Detail:There is1other session using the database.

To delete the testdb1 database, you need to follow the steps as described in the above section.

First, query the pg_stat_activityview to find what activities are taking place against the testdb1database:

2
4
6
*
pg_stat_activity
datname='testdb1';

The testdb1database has 1 connection from localhosttherefore it is safe to terminate this connection and remove the database.

Manually remove the postgres user you should work

Second, terminate the connection to the testdb1database by using the following statement:

2
4
6
pg_terminate_backend(pg_stat_activity.pid)
pg_stat_activity
pg_stat_activity.datname='testdb1';
The

Postgres User Password

Third, issue the DROP DATABASE command to remove the testdb1database:

PostgreSQL deleted the testdb1permanently.

In this tutorial, you have learned how to use the PostgreSQL DROP DATABASE statement to delete a database. In addition, you also learned how to delete a database that has active connections.

Drop User Postgres

  • Was this tutorial helpful ?