【centos系统安装mysql】CentOS系统安装 PostgreSQL9.4例子

更新时间:2019-11-18    来源:PostgreSQL    手机版     字体:

【www.bbyears.com--PostgreSQL】

添加软件源,以 PostgreSQL 9.4 为例

yum install http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-redhat94-9.4-1.noarch.rpm

安装数据库

yum -y install postgresql-server postgresql94 postgresql94-devel

建立数据库目录并赋予 postgres 用户权限

mkdir -p /home/pgsql/data
chown -R postgres:postgres /home/pgsql/

切换用户并初始化数据库目录

su - postgres
/usr/pgsql-9.4/bin/initdb -D /home/pgsql/data/ -E UTF-8 --locale=en_US.UTF-8

使用 root 用户修改启动脚本

vim /etc/init.d/postgresql-9.4

PGDATA=/home/pgsql/data     # 将 PGDATA 的值改为新建的数据库目录

启动数据库

/etc/init.d/postgresql-9.4 start

本文来源:http://www.bbyears.com/shujuku/79923.html

热门标签

更多>>

本类排行