PostgreSQL学习第三篇--安装后的配置

前端之家收集整理的这篇文章主要介绍了PostgreSQL学习第三篇--安装后的配置前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
为了以后方便,对pg安装路径建立软连接:
[root@single bin]# ln -sf /usr/pg/postgresql-9.6.1/ /usr/local/pgsql

配置postgres用户的.bash_profile


PATH=/usr/local/pgsql/bin:$PATH:$HOME/bin

export PATH

export LD_LIBRARY_PATH=/usr/local/pgsql/lib


创建数据库簇:
[postgres@single ~]$ initdb
initdb: no data directory specified
You must identify the directory where the data for this database system
will reside.  Do this with either the invocation option -D or the
environment variable PGDATA.

在.bash_profile中配置数据目录:

export PGDATA=/home/postgres/pgdata

[postgres@single ~]$ initdb
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 "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /home/postgres/pgdata ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... 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:

    pg_ctl -D /home/postgres/pgdata -l logfile start
原文链接:https://www.f2er.com/postgresql/194247.html

猜你在找的Postgre SQL相关文章