centos6.5安装postgresql

2019-08-26 11:30 阅读 2,026 views 次 centos6.5安装postgresql已关闭评论

https://www.postgresql.org/download/linux/redhat/

wget https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-6-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo yum install -y https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-6-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum install postgresql11
yum install postgresql11-server
service postgresql-11 initdb
chkconfig postgresql-11 on

vi /var/lib/pgsql/11/data/postgresql.conf
listen_addresses = '0.0.0.0'

vim /var/lib/pgsql/11/data/pg_hba.conf
在里面添加:

host all all 0.0.0.0/0 md5

service postgresql-11 start

sudo -u postgres psql
步骤二:修改登录PostgreSQL密码

1
ALTER USER postgres WITH PASSWORD 'postgres';

\q

重启服务器:

service postgresql-11 restart

防火墙打开5432端口

并且执行:

iptables -A INPUT -p tcp --dport 5432 -j ACCEPT

======php连接postgre

yum install php-pgsql

php -i | grep Loaded\ Configuration
Loaded Configuration File => /usr/local/php/etc/php.ini

vi/usr/local/php/etc/php.ini
extension=/usr/lib64/php/modules/pdo_pgsql.so
/etc/init.d/php-fpm reload

表建立在public模式下
INSERT INTO public.hi(
	"Id",seq, useridgf, appid, txt,gftime)
	VALUES (1,1,'aa', 'aaa', 'bb','2019-8-22');
版权声明:本文著作权归原作者所有,欢迎分享本文,谢谢支持!
转载请注明:centos6.5安装postgresql | 文档
分类:电脑技术 标签:

评论已关闭!