Create a database PostgreSQL Tip ERROR: source database "template1" is being accessed by other users

Solution

1) which is connected using a query, connect to the server to kill the process with shell

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

 

 

 Connect to the server kill off the process kill -9 13395  

 Then create you can create a success

2) specify the template when creating a database

 create database database database owner user ENCODING 'UTF-8' template = template0;

Guess you like

Origin www.cnblogs.com/wxiaoyanbk/p/12161620.html