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');
评论已关闭!