首页 > FreeBSD > FreeBSD9.1+PostpreSQL 9.3.0初始化
2013
09-29

FreeBSD9.1+PostpreSQL 9.3.0初始化

一北京朋友FreeBSD9.1 安装了PostpreSQL 9.3.0 说初始化无法启动,让帮看看。

root@freebsd:/usr/local/pgsql # uname -a  ->查看FreeBSD版本号

FreeBSD freebsd.org 9.1-RELEASE-p3 FreeBSD 9.1-RELEASE-p3 #0: Mon Apr 29 18:27:25 UTC 2013 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64

 

root@freebsd: # pkg_info | grep “postgresql*” ->查看PostpreSQL版本号。

postgresql-client-9.3.0 PostgreSQL database (client)
postgresql-server-9.3.0 The most advanced open-source database available anywhere

 

root@freebsd:/ # su pgsql ->切换到pgsql帐号

初始化PostgreSQL字符,默认初始化的字符编码是SQL_ASCII,这里我们设置成UTF8
关于更多编码参考以下官方说明
http://www.postgresql.org/docs/9.3/static/multibyte.html

$ /usr/local/bin/initdb /usr/local/pgsql/data –encoding=UTF8 ->初始化PostgreSQL数据库。

The files belonging to this database system will be owned by user "pgsql".
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".

Data page checksums are disabled.

creating directory /usr/local/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
creating configuration files ... ok
creating template1 database in /usr/local/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... 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
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

/usr/local/bin/postgres -D /usr/local/pgsql/data
or
/usr/local/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start

$

 

$ exit ->退出pgsql帐户

root@freebsd: # vi /etc/rc.conf ->编辑rc.conf配置文件加入以下项,可以开机自动运行PostpreSQL。
postgresql_enable=”YES”

root@freebsd:/ # /usr/local/etc/rc.d/postgresql start ->启动一下看看,报错syslog。

LOG: ending log output to stderr
HINT: Future log output will go to log destination "syslog".

 

root@freebsd: # vi /usr/local/pgsql/data/postgresql.conf ->编译PostgreSQL配置文件注示以下项,保存。
#log_destination = ‘syslog’
root@freebsd: # /usr/local/etc/rc.d/postgresql restart ->再然再重启动一下,正常启动,收工!

LOG: received fast shutdown request
LOG: aborting any active transactions
LOG: autovacuum launcher shutting down
LOG: shutting down
LOG: database system is shut down
LOG: database system was shut down at 2013-09-29 23:53:38 CST
LOG: database system is ready to accept connections
LOG: autovacuum launcher started

 

最后编辑:
作者:dnybz
这个作者貌似有点懒,什么都没有留下。