标签:style http color os 数据 io for art
系统:centos6.4 安装postgresql9.3
(防火墙需要开启5432端口)
yum install -y http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-redhat93-9.3-1.noarch.rpm
yum install -y postgresql93-server postgresql93-contrib
更改默认安装目录为/data/pgsql (可选,默认为/var/lib/postgres)
vim /etc/init.d/postgresql-9.3
更改
PGDATA=/data/pgsql/9.3/data
PGLOG=/data/pgsql/9.3/pgstartup.log
PGUPLOG=/data/pgsql/$PGMAJORVERSION/PGUPGRADE.log
service postgresql-9.3 initdb
chown postgres.postgres /data/pgsql
vim /etc/passwd (更改postgres用户家目录)
更改
postgres:x:26:26:PostgreSQLServer:/data/pgsql:/bin/bash
#vim /data/pgsql/9.3/data/pg_hba.conf (允许以下网段网段ip登录 )
host all all 192.168.1.0/24 md5 host all all 192.168.2.0/24 md5
#vim /data/pgsql/9.3/data/postgresql.conf (监听更改为*)
listen_addresses = ‘*‘
#service postgresql-9.3 start (启动数据库)
#su - postgres
$createuser --help (查看新建用户帮助) $createuser -s root 创建超级用户root (可选) -bash-4.1$ psql psql (9.3.2) Type "help" for help. postgres=# \du List of roles Role name | Attributes | Member of -----------+------------------------------------------------+----------- postgres | Superuser, Create role, Create DB, Replication | {} root | Superuser, Create role, Create DB | {}
创建一个mydb库 并赋予普通用户test 对mydb 拥有所有权限
$createdb mydb (创建名字为mydb的数据库) $createuser test (创建普通用户test) $psql postgres=# ALTER USER test with password ‘test‘; (为test用户更改密码为test) postgres=#grante all on database mydb TO test; postgres=# \q
参考:
postgresql install centos6.x,布布扣,bubuko.com
标签:style http color os 数据 io for art
原文地址:http://my.oschina.net/firxiao/blog/295027