资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

postgresql认证的简单介绍

postgresql有哪些认证

特性 MySQL PostgreSQL 实例 通过执行 MySQL 命令(mysqld)启动实例。一个实例可以管理一个或多个数据库。一台服务器可以运行多个 mysqld 实例。一个实例管理器可以监视 mysqld 的各个实例。 通过执行 Postmaster 进程(pg_ctl)启动实例。一个...

创新互联是一家集网站建设,陵川企业网站建设,陵川品牌网站建设,网站定制,陵川网站建设报价,网络营销,网络优化,陵川网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。

Ubuntu 16.04 怎样安装 PostgreSQL 和 phpPgAdmin

您好,很高兴能帮助您1.安装PostgreSQL首先根据你的服务器架构添加PostgreSQL库:对CentOS6.x32bit:rpm-Uvhtcpfirewall-cmd--reload3.访问PostgreSQL常用的命令提示符默认情况下数据库名和用户名都是postgres。切换至用户以执行相关操作:su–postgres输入以下命令登陆:psql会有以下样例输出:psql(9.3.5)Type"help"forhelp.Postgres=#可通过输入\q退出postgresql返回命令终端:4.设置用户密码登陆至postgres命令提示符界面su–postgrespsql然后使用命令设置密码postgres=#\passwordpostgresEnternewpassword:Enteritagain:postgres=#\q输入命令以建立PostgreSQL系统管理工具postgres=#CREATEEXTENSIONadminpack;CREATEEXTENSION5.创建用户和数据库例如:用户名:senthil密码:centos数据库名:mydb转到postgres用户su–postgres创建用户senthil$createusersenthil创建数据库$createdbmydb现在登陆至psql提示符界面,为用户senthil设置密码及授权对数据库mydb的访问:$psqlpsql(9.3.5)Type"help"forhelp.postgres=#alterusersenthilwithencryptedpassword'centos';ALTERROLEpostgres=#grantallprivilegesondatabasemydbtosenthil;GRANTpostgres=#6.删除用户和数据库首先转到postgres界面su–postgres输入命令$dropdb删除用户名可输入$dropuser7.配置PostgreSQL-MD5认证MD5认证需要客户端提供一个MD5-encrypted密码以便身份验证。你需要编辑/var/lib/pgsql/9.3/data/pg_hba.conf文件:vi/var/lib/pgsql/9.3/data/pg_hba.conf添加或修改的行如下:[]#TYPEDATABASEUSERADDRESSMETHOD#"local"isforUnixdomainsocketconnectionsonlylocalallallmd5#IPv4localconnections:hostallall127.0.0.1/32md5hostallall192.168.1.0/24md5#IPv6localconnections:hostallall::1/128md5[]重启postgresql服务以应用更改在CentOS6.x系统中servicepostgresql-9.3restart在CentOS7系统中systemctlrestartpostgresql-9.38.配置PostgreSQL-ConfigureTCP/IP默认情况下,TCP/IP连接是不可行的,所以其他计算机用户不能连接到postgresql。编辑文件/var/lib/pgsql/9.3/data/postgresql.conf可以允许连接:vi/var/lib/pgsql/9.3/data/postgresql.conf找到下面的行:[]#listen_addresses='localhost’[]#port=5432[]把两行都取消并设置为你的postgresql服务器IP地址或设置为“*”监听所有客户端。如下所示:listen_addresses='*'port=5432重启以应用更改在CentOS6.x系统中:/etc/init.d/postgresql-9.3restart在CentOS7系统中:systemctlrestartpostgresql-9.39.使用phpPgAdmin管理PostgreSQLphpPgAdmin是使用PHP编写的基于web的管理工具,用于管理PostgreSQL。它只适用与PostgreSQLRPM库。你的采纳是我前进的动力,记得好评和采纳,答题不易,互相帮助,

如何把postgresql 加入systemctl

您高兴能帮助您 1.安装PostgreSQL 首先根据服务器架构添加PostgreSQL库: CentOS 6.x 32bit: rpm -Uvh 1.noarch.rpm CentOS 6.x 64bit: rpm -Uvh

.安装PostgreSQL

首先根据服务器架构添加PostgreSQL库:

于其发行版查看链接并建立库:

使用命令更新库:

yum update

使用命令安装PostgreSQL:

yum install postgresql93-server postgresql93-contrib

使用命令初始化PostgreSQL数据库:

CentOS 6.x 系统:

service postgresql-9.3 initdb

CentOS 7系统:

/usr/pgsql-9.3/bin/postgresql93-setup initdb

启PostgreSQL服务并使机自启:

CentOS 6.x 系统:

service postgresql-9.3 start

chkconfig postgresql-9.3 on

CentOS 7系统:

systemctl enable postgresql-9.3

systemctl start postgresql-9.3

2.调整Iptables/Firewall

接调整防火墙站规则:

CentOS 6.x系统:

vi /etc/sysconfig/iptables

并添加行

-A INPUT -m state --state NEW -m tcp -p tcp --dport 5432 -j ACCEPT

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

退并保存文件重启iptables服务:

service iptables restart

CentOS系统:

firewall-cmd --permanent –add-port=5432/tcp

firewall-cmd --permanent –add-port=80/tcp

firewall-cmd --reload

3.访问PostgreSQL用命令提示符

默认情况数据库名用户名都postgres切换至用户执行相关操作:

su – postgres

输入命令登陆:

psql

例输:

psql (9.3.5)

Type "help" for help.

Postgres=#

通输入\q退postgresql返命令终端:

4.设置用户密码

登陆至postgres命令提示符界面

su – postgres

psql

使用命令设置密码

postgres=# \password postgres

Enter new password:

Enter it again:

postgres=# \q

输入命令建立PostgreSQL系统管理工具

postgres=# CREATE EXTENSION adminpack;

CREATE EXTENSION

5.创建用户数据库

例:用户名:senthil 密码:centos 数据库名:mydb

转postgres用户

su – postgres

创建用户senthil

$ createuser senthil

创建数据库

$ createdb mydb

现登陆至psql提示符界面用户senthil设置密码及授权数据库mydb访问:

$ psql

psql (9.3.5)

Type "help" for help.

postgres=# alter user senthil with encrypted password 'centos';

ALTER ROLE

postgres=# grant all privileges on database mydb to senthil;

GRANT

postgres=#

6.删除用户数据库

首先转postgres界面

su – postgres

输入命令

$ dropdb database-name

删除用户名输入

$ dropuser user-name

7.配置PostgreSQL-MD5认证

MD5认证需要客户端提供MD5-encrypted 密码便身份验证需要编辑 /var/lib/pgsql/9.3/data/pg_hba.conf文件:

vi /var/lib/pgsql/9.3/data/pg_hba.conf

添加或修改行:

[...]

# TYPE DATABASE USER ADDRESS METHOD

# "local" is for Unix domain socket connections only

local all all md5

# IPv4 local connections:

host all all 127.0.0.1/32 md5

host all all 192.168.1.0/24 md5

# IPv6 local connections:

host all all ::1/128 md5

[...]

重启postgresql服务应用更改

CentOS 6.x系统

service postgresql-9.3 restart

CentOS 7系统

systemctl restart postgresql-9.3

8.配置PostgreSQL-Configure TCP/IP

默认情况TCP/IP连接行所其计算机用户能连接postgresql编辑文件 /var/lib/pgsql/9.3/data/postgresql.conf允许连接:

vi /var/lib/pgsql/9.3/data/postgresql.conf

找面行:

[...]

#listen_addresses = 'localhost’

[...]

#port = 5432

[...]

两行都取消并设置postgresql服务器IP址或设置*监听所客户端所示:

listen_addresses = '*'

port = 5432

重启应用更改

CentOS6.x系统:

/etc/init.d/postgresql-9.3 restart

CentOS7系统:

systemctl restart postgresql-9.3

9.使用phpPgAdmin管理PostgreSQL

phpPgAdmin使用PHP编写基于web管理工具用于管理PostgreSQL适用与PostgreSQL RPM库

没添加PostgreSQL库添加EPEL库

使用命令更新库

yum update

现输入命令安装phpPgAdmin:

yum install phpPgAdmin httpd

注意phpPgAdmin区写要准确使用面所示写

编辑文件/etc/httpd/conf.d/phpPgAdmin.conf

vi /etc/httpd/conf.d/phpPgAdmin.conf

修改加粗部:

[...]

Alias /phpPgAdmin /usr/share/phpPgAdmin

Location /phpPgAdmin

IfModule mod_authz_core.c

# Apache 2.4

Require all granted

#Require host example.com

/IfModule

IfModule !mod_authz_core.c

# Apache 2.2

Order deny,allow

Allow from all

# Allow from .example.com

/IfModule

/Location

启或重启Apache服务

CentOS 6.x系统

service httpd start

chkconfig httpd on

CentOS 7系统

systemctl enable httpd

systemctl start httpd

现打浏览器并转终于看面界面

使用前创建用户登录我用户senthil密码CentOS

能遇:Login failed

SELLinux能限制用户连接PostgreSQL需输入命令更改即:

setsebool -P httpd_can_network_connect_db 1

现应该能登录

我phpPgAdimn:

OK现使用图形化界面phpPgAdmin创建、删除管理数据库

如何在CentOS 7/6.5/6.4 下安装PostgreSQL 9.3 与 phpPgAdmin

PostgreSQL是一个强大开源的对象关系类型数据库系统,它能运行于几乎所有主要的操作系统,包括Linux、Unix(AIX、BSD、HP-UX、SGIIRIX、MacOS、Solaris、Tru64)、WindowsOS。在这篇教程里,我们将学习如何在CentOS7/6.5/6.4server中建立PostgreSQL。1.安装PostgreSQL首先根据你的服务器架构添加PostgreSQL库:对CentOS6.x32bit:rpm-Uvhtcpfirewall-cmd--reload3.访问PostgreSQL常用的命令提示符默认情况下数据库名和用户名都是postgres。切换至用户以执行相关操作:su–postgres输入以下命令登陆:psql会有以下样例输出:psql(9.3.5)Type"help"forhelp.Postgres=#可通过输入\q退出postgresql返回命令终端:4.设置用户密码登陆至postgres命令提示符界面su–postgrespsql然后使用命令设置密码postgres=#\passwordpostgresEnternewpassword:Enteritagain:postgres=#\q输入命令以建立PostgreSQL系统管理工具postgres=#CREATEEXTENSIONadminpack;CREATEEXTENSION5.创建用户和数据库例如:用户名:senthil密码:centos数据库名:mydb转到postgres用户su–postgres创建用户senthil$createusersenthil创建数据库$createdbmydb现在登陆至psql提示符界面,为用户senthil设置密码及授权对数据库mydb的访问:$psqlpsql(9.3.5)Type"help"forhelp.postgres=#alterusersenthilwithencryptedpassword'centos';ALTERROLEpostgres=#grantallprivilegesondatabasemydbtosenthil;GRANTpostgres=#6.删除用户和数据库首先转到postgres界面su–postgres输入命令$dropdb删除用户名可输入$dropuser7.配置PostgreSQL-MD5认证MD5认证需要客户端提供一个MD5-encrypted密码以便身份验证。你需要编辑/var/lib/pgsql/9.3/data/pg_hba.conf文件:vi/var/lib/pgsql/9.3/data/pg_hba.conf添加或修改的行如下:[]#TYPEDATABASEUSERADDRESSMETHOD#"local"isforUnixdomainsocketconnectionsonlylocalallallmd5#IPv4localconnections:hostallall127.0.0.1/32md5hostallall192.168.1.0/24md5#IPv6localconnections:hostallall::1/128md5[]重启postgresql服务以应用更改在CentOS6.x系统中servicepostgresql-9.3restart在CentOS7系统中systemctlrestartpostgresql-9.38.配置PostgreSQL-ConfigureTCP/IP默认情况下,TCP/IP连接是不可行的,所以其他计算机用户不能连接到postgresql。编辑文件/var/lib/pgsql/9.3/data/postgresql.conf可以允许连接:vi/var/lib/pgsql/9.3/data/postgresql.conf找到下面的行:[]#listen_addresses='localhost’[]#port=5432[]把两行都取消并设置为你的postgresql服务器IP地址或设置为“*”监听所有客户端。如下所示:listen_addresses='*'port=5432重启以应用更改在CentOS6.x系统中:/etc/init.d/postgresql-9.3restart在CentOS7系统中:systemctlrestartpostgresql-9.39.使用phpPgAdmin管理PostgreSQLphpPgAdmin是使用PHP编写的基于web的管理工具,用于管理PostgreSQL。它只适用与PostgreSQLRPM库。如果你没有添加PostgreSQL库,你可以添加EPEL库。可根据下面的链接在CentOS6.x中建立EPEL库


网页名称:postgresql认证的简单介绍
转载来源:http://cdkjz.cn/article/dscdgeo.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220