不知怎的,我已经成功完成了在Ubuntu karmic上安装postgresql的麻烦.我想从头开始,但是当我用apt-get"清除"包时,它仍然留下痕迹,使重新安装配置无法正常运行.
我做完之后:
apt-get purge postgresql
apt-get install postgresql
Run Code Online (Sandbox Code Playgroud)
它说
Setting up postgresql-8.4 (8.4.3-0ubuntu9.10.1) ...
Configuring already existing cluster (configuration: /etc/postgresql/8.4/main, data: /var/lib/postgresql/8.4/main, owner: 108:112)
Error: move_conffile: required configuration file /var/lib/postgresql/8.4/main/postgresql.conf does not exist
Error: could not create default cluster. Please create it manually with
pg_createcluster 8.4 main --start
or a similar command (see 'man pg_createcluster').
update-alternatives: using /usr/share/postgresql/8.4/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode.
Setting up postgresql (8.4.3-0ubuntu9.10.1) ...
Run Code Online (Sandbox Code Playgroud)
我有一个"/ etc/postgresql",其中没有任何内容,"/ etc/postgresql-common /"有一个'pg_upgradecluser.d'目录和root.crt和user_clusters文件.
/ etc/passwd有一个postgres用户; 清除脚本似乎没有触及它.我经历过一系列症状只是为了暴露下一个.
这一秒,当我运行该命令"pg_createcluster ..."时,它抱怨'/var/lib/postgresql/8.4/main/postgresql.conf不存在',所以我会找到其中一个,但我我肯定不会结束它. …
如何使用sql或phpPgAdmin更改PostgreSQL数据库的数据库编码?
我们的postgres生产数据库服务器有一个名为crd_production的数据库,它出自template1模板数据库.顺便提一下,在Ubuntu 12.04框中,初始创建pgcluster时template1和template0数据库的默认编码的默认编码为LATIN1.我删除了template1数据库并使用utf-8编码重新创建它,如下所示.
Name | Owner | Encoding | Collate | Ctype | Access privileges
----------------+----------+----------+------------+------------+-----------------------
crd_production | deployer | UTF8 | en_US.utf8 | en_US.utf8 |
postgres | postgres | UTF8 | en_US.utf8 | en_US.utf8 |
template0 | postgres | LATIN1 | en_US | en_US | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.utf8 | en_US.utf8 |
(4 rows)
Run Code Online (Sandbox Code Playgroud)
我们最终部署了rails(3.2.11)app并开始使用crd_productiondb作为主数据库.ActiveRecord写入/读取数据时没有问题,但是当我尝试从此psql数据库上的命令行触发任何sql查询时,会发生以下错误 -
crd_production=# select * from users; …Run Code Online (Sandbox Code Playgroud) 我有一个数据库,该数据库是在安装了"Default Locale"的数据库服务器上创建的,其中要求"选择新数据库集群使用的语言环境".它应该已设置为特定的区域设置.我之后可以改变它,还是必须从头开始创建数据库?