Skip to content

Instantly share code, notes, and snippets.

@andostronaut
Last active March 3, 2025 14:08
Show Gist options
  • Save andostronaut/a93b0e3f3eec4f19a358914413e08c94 to your computer and use it in GitHub Desktop.
Save andostronaut/a93b0e3f3eec4f19a358914413e08c94 to your computer and use it in GitHub Desktop.
Terminate PostgresSQL in Docker
docker exec -it container_name psql -U db_user -d postgres
revoke connect on database target_db from public;
select pg_terminate_backend(pg_stat_activity.pid)
from pg_stat_activity
where pg_stat_activity.datname = 'target_db';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment