联系:手机/微信(+86 17813235971) QQ(107644445)
标题:pg创建gbk字符集库
作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]
记录下,Postgres库创建中文字符集
postgres=# CREATE DATABASE mydb_gbk
postgres-# ENCODING 'EUC_CN'
postgres-# LC_COLLATE 'zh_CN'
postgres-# LC_CTYPE 'zh_CN'
postgres-# TEMPLATE template0;
CREATE DATABASE
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | ICU Locale | Locale Provider | Access privileges
-----------+----------+----------+-------------+-------------+------------+-----------------+-----------------------
mydb_gbk | postgres | EUC_CN | zh_CN | zh_CN | | libc |
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc | =c/postgres +
| | | | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc | =c/postgres +
| | | | | | | postgres=CTc/postgres
(4 rows)
前提系统必须支持zh_CN语言包,检查命令为:
[root@xifenfei yum.repos.d]# locale -a |grep zh_CN zh_CN zh_CN.gb18030 zh_CN.gbk zh_CN.utf8
如果没有使用yum以下命令安装
yum groupinstall "fonts" yum install glibc-langpack-zh.x86_64
