Postgres语言环境错误

时间:2013-07-17 14:24:43

标签: postgresql unix ubuntu locale

我在Digital River上托管了一个Postgres数据库,在Ubuntu上,followed these instructions to install

但是区域设置有问题,我无法解决如何修复它。当我运行psql命令时,我收到以下错误:

postgres@assay:/home/deployer$ psql
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US:en",
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
psql (9.1.9)

2 个答案:

答案 0 :(得分:28)

非常感谢数字河论坛上的Kamal Nasser提供正确的答案(以下命令需要root权限):

$ locale-gen en_US en_US.UTF-8 
$ dpkg-reconfigure locales

我认为这是原始答案的正确链接:数字海洋网站没有响应,所以我无法检查它。  https://www.digitalocean.com/community/questions/postgresql-and-rails-4

答案 1 :(得分:9)

在尝试了ardochhigh的回答之后:

$ sudo locale-gen en_US en_US.UTF-8 
$ sudo dpkg-reconfigure locales

问题仍然存在

之后我看到这个答案解决了我的问题:

https://www.digitalocean.com/community/questions/language-problem-on-ubuntu-14-04

通常没有设置LAGUAGE shell变量:

$ sudo bash

$ export LANGUAGE="en_US.UTF-8"
$ echo 'LANGUAGE="en_US.UTF-8"' >> /etc/default/locale
$ echo 'LC_ALL="en_US.UTF-8"' >> /etc/default/locale

$ # next: logout and login