pg linux initdb不能指定encode?

[复制链接]
查看11 | 回复2 | 2012-5-21 10:19:41 | 显示全部楼层 |阅读模式
[root@redflag11012501 user1]# ls *rpm
postgres-9.0.4-1.x86_64.openscg.rpm
[root@redflag11012501 user1]# rpm -ivh *rpm
Preparing...
########################################### [100%]
1

ostgres-9.0 ########################################### [100%]
[root@redflag11012501 user1]# su - postgres
-bash-3.2$ cd /opt/postgresql/bin
-bash: cd: /opt/postgresql/bin: 没有那个文件或目录
-bash-3.2$ cd /opt
-bash-3.2$ ls post*
9.0
-bash-3.2$ cd post*/9.0
-bash-3.2$ pwd
/opt/postgres/9.0
-bash-3.2$ cd bin
-bash-3.2$ ./initdb --encoding=utf8 -D /user1/postgresql/data
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale zh_CN.GB18030.
initdb: encoding mismatch
The encoding you selected (UTF8) and the encoding that the
selected locale uses (GB18030) do not match.This would lead to
misbehavior in various character string processing functions.
Rerun initdb and either do not specify an encoding explicitly,
or choose a matching combination.
-bash-3.2$
回复

使用道具 举报

千问 | 2012-5-21 10:19:41 | 显示全部楼层
想当然的解决办法...
-bash-3.2$ rpm -qa|grep post
postfix-pflogsumm-2.3.3-2.9AXS3
postgresql-tcl-8.1.18-2.1.1AXS3
postgresql-libs-8.1.18-2.1.1AXS3
postgresql-docs-8.1.18-2.1.1AXS3
postgres-9.0-9.0.4-1
postgresql-devel-8.1.18-2.1.1AXS3
postfix-2.3.3-2.9AXS3
postgresql-pl-8.1.18-2.1.1AXS3
postgresql-odbc-08.01.0200-3.1
postgresql-devel-8.1.18-2.1.1AXS3
freeradius-postgresql-1.1.3-1.6.AXS3
postgresql-contrib-8.1.18-2.1.1AXS3
postgresql-server-8.1.18-2.1.1AXS3
postgresql-8.1.18-2.1.1AXS3
postgresql-python-8.1.18-2.1.1AXS3
postgresql-jdbc-8.1.407-1jpp.4
postgresql-libs-8.1.18-2.1.1AXS3
-bash-3.2$ env
HOSTNAME=redflag11012501
SHELL=/bin/bash
TERM=vt100
HISTSIZE=1000
QTDIR=/usr/lib64/qt-3.3
OLDPWD=/opt/postgres/9.0
QTINC=/usr/lib64/qt-3.3/include
DM_HOME=/user1/dm
USER=postgres
LD_LIBRARY_PATH=/user1/dm/bin
LS_COLORS=no=00:fi=00:di=01;34:ln=01;36

i=40;33:so=01;35:bd=40;33;01:cd=40;33;01

r=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:
KDEDIR=/usr
MAIL=/var/spool/mail/postgres
PATH=/usr/lib/jdk/bin:/usr/lib64/qt-3.3/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin
INPUTRC=/etc/inputrc
PWD=/opt/postgres/9.0/bin
JAVA_HOME=/usr/lib/jdk
LANG=zh_CN.GB18030
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
SHLVL=1
HOME=/var/lib/pgsql
LANGUAGE=zh_CN.GB18030:zh_CN.GB2312:zh_CN
LOGNAME=postgres
QTLIB=/usr/lib64/qt-3.3/lib
CVS_RSH=ssh
PGDATA=/var/lib/pgsql/data
LESSOPEN=|/usr/bin/lesspipe.sh %s
G_BROKEN_FILENAMES=1
_=/bin/env
-bash-3.2$ export LANG=C
-bash-3.2$ ./initdb --encoding=utf8 -D /user1/postgresql/data
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale C.
The default text search configuration will be set to "english".
creating directory /user1/postgresql/data ... initdb: could not create directory "/user1/postgresql": Permission denied
-bash-3.2$ su -
Password:
[root@redflag11012501 ~]# mkdir /user1/postgresql
[root@redflag11012501 ~]# chown postgresql:dba /user1/postgresql
chown: “postgresql:dba”: 无效的用户
[root@redflag11012501 ~]# chown postgres:dba /user1/postgresql
[root@redflag11012501 ~]# exit
logout
-bash-3.2$ ./initdb --encoding=utf8 -D /user1/postgresql/data
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale C.
The default text search configuration will be set to "english".
creating directory /user1/postgresql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
creating configuration files ... ok
creating template1 database in /user1/postgresql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.
Success. You can now start the database server using:
./postgres -D /user1/postgresql/data
or
./pg_ctl -D /user1/postgresql/data -l logfile start
-bash-3.2$ ./postgres -D /user1/postgresql/data &
[1] 27388
-bash-3.2$ LOG:database system was shut down at 2011-04-24 12:57:09 CST
LOG:autovacuum launcher started
LOG:database system is ready to accept connections
-bash-3.2$ createdb pgdb
CREATE DATABASE
-bash-3.2$ psql pgdb
Welcome to psql 8.1.18 (server 9.0.4), the PostgreSQL interactive terminal.
Type:\copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
WARNING:You are connected to a server with major version 9.0,
but your psql client is major version 8.1.Some backslash commands,
such as \d, might not work properly.
pg
回复

使用道具 举报

千问 | 2012-5-21 10:19:41 | 显示全部楼层
虽然在/usr/bin也有postgres但不能用那个
-bash-3.2$ whereis postgres
postgres: /usr/bin/postgres /usr/share/man/man1/postgres.1.gz
-bash-3.2$ postgres -D /user1/postgresql/data
致命错误:在文件 "/user1/postgresql/data/postgresql.conf" 第 109 行, 记号 "MB" 附近语法错误
。。。
-bash-3.2$ postgres -D /user1/postgresql/data &
[1] 25986
-bash-3.2$ 致命错误:未认可的配置参数 "default_text_search_config"
[1]+Exit 1
postgres -D /user1/postgresql/data
。。。
-bash-3.2$ export LANG=C
-bash-3.2$ postgres -D /user1/postgresql/data &
[1] 26049
-bash-3.2$ FATAL:unrecognized configuration parameter "default_text_search_config"
[1]+Exit 1
postgres -D /user1/postgresql/data
-bash-3.2$ cd /opt/postgres/9.0
-bash-3.2$ cd bin
-bash-3.2$ pwd
/opt/postgres/9.0/bin
-bash-3.2$ ./postgres -D /user1/postgresql/data &
[1] 26117
-bash-3.2$ LOG:database system was interrupted; last known up at 2011-04-25 13:06:56 CST
LOG:database system was not properly shut down; automatic recovery in progress
LOG:consistent recovery state reached at 4/46BCD840
LOG:record with zero length at 4/46BCD840
LOG:redo is not required
LOG:autovacuum launcher started
LOG:database system is ready to accept connections
-bash-3.2$ psql pgdb
Welcome to psql 8.1.18 (server 9.0.4), the PostgreSQL interactive terminal.
Type:\copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
WARNING:You are connected to a server with major version 9.0,
but your psql client is major version 8.1.Some backslash commands,
such as \d, might not work properly.
pgdb=#
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行