postgresql导入中文报错怎么办[mongodb教程]
postgresql导入中文报错,因为没有修改环境变量,导致安装完数据库,数据库默认字符集变成LATIN1,如下所示。
postgres=# lList of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+---------+-------+-----------------------
peimsmdb | peimsmer | LATIN1 | en_US | en_US | =Tc/peimsmer +
| | | | | peimsmer=CTc/peimsmer
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
所以如果安装数据库时修改了环境变量,就不会出现之后的问题。
修改环境变量
# vi /etc/profileexport.UTF-8
export LC_ALL=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
# source /etc/profile
更多学习内容,请点击Python学习网。
以上是 postgresql导入中文报错怎么办[mongodb教程] 的全部内容, 来源链接: utcz.com/z/525935.html