用户登录
用户注册

分享至

ubuntu安装postgresql

  • 作者: kzh小柯
  • 来源: 51数据库
  • 2020-09-25
您好,很高兴能帮助您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.删除用户和数据库首先转到p...



  您好,很高兴能帮助您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库。你的采纳是我前进的动力,记得好评和采纳,答题不易,互相帮助,
软件
前端设计
程序设计
Java相关