wget https://ftp.postgresql.org/pub/source/v10.1/postgresql-10.1.tar.gz
mkdir -p /app/soft/postgresql/data
tar -zxvf postgresql-10.1.tar.gz -C /app/soft/
cd /app/soft/postgresql-10.1
./configure --prefix=/app/soft/postgresql
make && make install
chown -R postgres.postgres /app/soft/postgresql
su - postgres
/app/soft/postgresql/bin/initdb -D /app/soft/postgresql/data/
/app/soft/postgresql/bin/pg_ctl -D /app/soft/postgresql/data/ -l logfile start
/app/soft/postgresql/bin/psql
ALTER USER postgres WITH PASSWORD '123456';
1.修改data/pg_hba.conf文件中,添加下面的一行
host all all 0.0.0.0/0 md5
2.修改postgresql.conf
修改listen_addresses='localhost'为listen_addresses='*'
/app/soft/postgresql/bin/pg_ctl -D /app/soft/postgresql/data/ -l logfile restart
问题解决
- 1、安装postgreSQL出现错误提示
configure: error: readline library not found
yum install readline-devel
- 2、安装postgreSQL出现错误提示
configure: error: zlib library not found
yum install zlib-devel
授权表权限
GRANT SELECT ON table_1 TO zhangsan_ro;
GRANT SELECT ON ALL tables IN SCHEMA PUBLIC TO zhangsan_ro;