新建数据库失败,提示"template1" being accessed by other users

来源:互联网 发布:c语言main是什么意思 编辑:程序博客网 时间:2024/05/23 12:29
新建数据库提示:
[PostgreSQL] "template1" being accessed by other users

说明该template1模板正在被人连接。我选择的解决方案是:
查询出连接该数据库的进程,并将其杀死(比较暴力)。
select pg_terminate_backend(pid) from pg_stat_activity where DATNAME = 'template1';
0 0