PostgreSQL创建数据库提示ERROR: source database "template1" is being accessed by other users

解决方法

1)查询是哪些连接使用了,用shell 连接到服务器 杀掉进程

    select procpid,* from pg_stat_activity where DATNAME='template1';

 

 

 连接到服务器 kill 掉进程 kill -9 13395  

 再创建就可以创建成功了

2) 创建数据库时指定template

 create database 数据库 owner 数据库用户 ENCODING 'UTF-8' template=template0;

posted @ 2020-01-07 15:05  wxiaobudianer  阅读(1169)  评论(0)    收藏  举报