POSTGRESQL DEFAULT TEMPLATE0 НА UTF8 ENCODING
1 2 | DataError: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII) HINT: Use the same encoding as in the template database, or use template0 as template. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | root@server:~# su postgres postgres@server:~ $ psql -U postgres psql (9.0.3) Type "help" for help. postgres=# update pg_database set datallowconn = TRUE where datname = 'template0' ; UPDATE 1 postgres=# \c template0 You are now connected to database "template0" . template0=# update pg_database set datistemplate = FALSE where datname = 'template1' ; UPDATE 1 template0=# drop database template1; DROP DATABASE template0=# create database template1 with template = template0 encoding = 'UTF8' ; CREATE DATABASE template0=# update pg_database set datistemplate = TRUE where datname = 'template1' ; UPDATE 1 template0=# \c template1 You are now connected to database "template1" . template1=# update pg_database set datallowconn = FALSE where datname = 'template0' ; UPDATE 1 template1=# Ctrl+Z postgres@server:~ $ exit root@server:~# |
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步