evf*_*qcg 6 database postgresql encoding
我有以下数据库
sudo -u postgres psql -c "\list"
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+---------+-------+-----------------------
postgres | postgres | LATIN1 | en_US | en_US |
template0 | postgres | LATIN1 | en_US | en_US | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | LATIN1 | en_US | en_US | =c/postgres +
| | | | | postgres=CTc/postgres
(3 rows)
Run Code Online (Sandbox Code Playgroud)
我怎样才能改变编码从LATIN1到UTF8数据库template1
或template0
?
由于这里似乎没有任何实际数据,因此只需关闭并删除集群(服务器和数据库集)并重新创建它即可。您使用哪个操作系统?创建新集群的标准 PostgreSQL 命令是 initdb,但在 Debian/Ubuntu 等上,您通常会使用pg_createcluster
尽管您可以尝试调整编码,但不建议这样做。尽管我在该链接的问题中建议了它,但如果您此处有包含 latin1 字符的数据,则需要将它们重新编码为 utf-8。
归档时间: |
|
查看次数: |
6674 次 |
最近记录: |