postgresql Postgres 语言环境错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17712700/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 01:01:25  来源:igfitidea点击:

Postgres locale error

postgresqlunixubuntulocale

提问by ardochhigh

I have a Postgres database hosted on Digital River, on Ubuntu, and followed these instructions to install:

我在 Ubuntu 上的 Digital River 上托管了一个 Postgres 数据库,并按照以下说明进行安装

But something is wrong with the locale settings and I cannot work out how to fix it. When I run the psql command I get the following error:

但是语言环境设置有问题,我不知道如何修复它。当我运行 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)

回答by ardochhigh

Thank you very much to Kamal Nasser on the Digital River forums for providing the correct answer (the following commands below requires root privileges):

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

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

I think this is the correct link to the original answer: the Digital Ocean site is not responding so I can't check it. https://www.digitalocean.com/community/questions/postgresql-and-rails-4

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

回答by Jo?o Reis

After trying ardochhigh's answer:

尝试 ardochhigh 的回答后:

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

the problem persisted

问题仍然存在

After that I saw this answer that solved the problem for me:

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

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

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

Aparently LAGUAGE shell variable is not set:

Aparently 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