#tar zxvf *.tar.gz
#cd /data/sky/postgresql-9.0.4
#./configuire --prefix=/data/sky/postgresql
#make && make install
#useradd postgres
#mkdir /data/sky/postgresql/data
#chown -R postgres:postgres /data/sky/postgresql
#su - postgres
$/data/sky/postgresql/bin/initdb -D /data/sky/postgresql/data -E utf8 --no-locale
/*
*initdb命令请参考initdb --help 或 initdb命令.doc
*默认读取服务器中的字符集,我机器上的字符集为zh_CN.GB18030
*不在所支持的字符集里面,所以我使用utf8 请查看 字符集支持.doc
*--no-locale加上这个不使用系统的东西
*/
-----------------------------成功提示如下------------------------------------
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".
fixing permissions on existing directory /data/sky/postgresql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
creating configuration files ... ok
creating template1 database in /data/sky/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:
/data/sky/postgresql/bin/postgres -D /data/sky/postgresql/data
or
/data/sky/postgresql/bin/pg_ctl -D /data/sky/postgresql/data -l logfile start
---------------------------------------------------------------------------------
/*
*成功初始化,会在data目录下生成相应的文件;
*请注意postgresql.conf,pg_hba.conf文件;如果用于生产环境需要进行优化配置。
*
*/
./createuser -d -e -P -l -r -s --host=127.0.0.1 --port=5432 相当于创建超级用户
./createdb -e --owner=root --host=127.0.0.1 --port=5432 mydb 创建mydb库
./psql --dbname=mydb --host=127.0.0.1 --port=5432 登录mydb
阅读(989) | 评论(0) | 转发(0) |