Ubuntu 12.04下PostgreSQL-9.1安装与配置详解(在线安装) [转]
说明:
第一步:在Ubuntu下安装Postgresql
root@server2-virtual-machine:~# apt-get install -y postgresql-9.1 postgresql-client-9.1 postgresql-contrib-9.1 postgresql-server-dev-9.1
第二步:修改PostgreSQL数据库的默认用户postgres的密码(注意不是linux系统帐号)
2.PostgreSQL登录(使用psql客户端登录)
root@server2-virtual-machine:~# sudo -u postgres psql
//其中,sudo -u postgres 是使用postgres 用户登录的意思
//PostgreSQL数据默认会创建一个postgres的数据库用户作为数据库的管理员,密码是随机的,所以这里
//设定为'postgres'
3.修改PostgreSQL登录密码:
postgres=# ALTER USER postgres WITH PASSWORD 'postgres';
//postgres=#为PostgreSQL下的命令提示符
4.退出PostgreSQL psql客户端
postgres=# \q
[代码说明]
[功能说明]
第三步:修改linux系统的postgres用户的密码(密码与数据库用户postgres的密码相同)
1.删除PostgreSQL用户密码
root@server2-virtual-machine:~# sudo passwd -d postgres
passwd: password expiry information changed.
//passwd -d 是清空指定用户密码的意思
2.设置PostgreSQL用户密码
PostgreSQL数据默认会创建一个linux用户postgres,通过上面的代码修改密码为'postgres’(这取决于
第二步中的密码,只要与其相同即可)。
root@server2-virtual-machine:~#sudo -u postgres passwd
输入新的 UNIX 密码:
重新输入新的 UNIX 密码:
passwd:已成功更新密码
第四步:修改PostgresSQL数据库配置实现远程访问
root@server2-virtual-machine:~# vi /etc/postgresql/9.1/main/postgresql.conf
1.监听任何地址访问,修改连接权限
#listen_addresses = ‘localhost’改为 listen_addresses = ‘*’
2.启用密码验证
#password_encryption = on改为password_encryption = on
3.可访问的用户ip段
root@server2-virtual-machine:~# vi /etc/postgresql/9.1/main/pg_hba.conf,并在文档末尾加上以下内容
# to allow your client visiting postgresql server
host all all 0.0.0.0 0.0.0.0 md5
4.重启PostgreSQL数据库
root@server2-virtual-machine:~# /etc/init.d/postgresql restart
第五步:管理PostgreSQL用户和数据库
1.登录postgre SQL数据库
root@server2-virtual-machine:~# psql -U postgres -h 127.0.0.1
2.创建新用户zhaofeng,但不给建数据库的权限
postgres=# create user “zhaofeng” with password ‘123456’ nocreatedb;
//注意用户名要用双引号,以区分大小写,密码不用
3.建立数据库,并指定所有者
postgres=# create database “testdb” with owner=”zhaofeng”;
4.在外部命令行的管理命令
root@server2-virtual-machine:~# -u postgres createuser -D -P test1
//-D该用户没有创建数据库的权利,-P提示输入密码,选择管理类型y/n
root@server2-virtual-machine:~# -u postgres createdb -O test1 db1
//-O设定所有者为test1
第六步:安装postgresql数据库pgAdmin3客户端管理程序
root@server2-virtual-machine:~# apt-get install -y pgadmin3
Ubuntu 12.04下PostgreSQL-9.1安装与配置详解(在线安装) [转]的更多相关文章
- Ubuntu 12.04下PostgreSQL-9.1安装与配置详解(在线安装)
说明: 我是用root用户在终端登陆的,如果是非root用户,那在命令前需要加上"sudo",你懂的... 第一步:在Ubuntu下安装Postgresql ...
- 在Ubuntu 12.04下采用apt-get的方法安装Qt4
在Ubuntu 12.04下采用apt-get的方法安装Qt4 注:之前发表的一篇博客是采用编译源码的方式安装Qt4,这是很有用的方式,因为源码安装对于所有系统都是通用的,其次,在使用交叉编译器的时候 ...
- Ubuntu 12.04下GAMIT10.40安装说明
转载于:http://www.itxuexiwang.com/a/liunxjishu/2016/0225/164.html?1456481297 Ubuntu 12.04下GAMIT10.40安装步 ...
- Angularjs学习---angularjs环境搭建,ubuntu 12.04下安装nodejs、npm和karma
1.下载angularjs 进入其官网下载:https://angularjs.org/,建议下载最新版的:https://ajax.googleapis.com/ajax/libs/angular ...
- Ubuntu 12.04 下安装 Eclipse
方法一:(缺点是安装时附加openjdk等大量程序并无法去除,优点是安装简单) $ sudo apt-get install eclipse 方法二:(优点是安装内容清爽,缺点是配置麻烦)1.安装JD ...
- Ubuntu 12.04下安装QQ 2012 Beta3(转)
Ubuntu 12.04下安装QQ 2012 Beta3 由于wine的发展非常迅速.现在网上的利用老版本的wine来安装QQ2012的教程已经有些过时了.实际上操作起来非常简单: 第一步:Ctr ...
- [转载] Ubuntu 12.04下安装git,SSH及出现的Permission denied解决办法
如何安装ssh http://os.51cto.com/art/201109/291634.htm 仅需要阅读至成功开启ssh服务即可 http://www.linuxidc.com/Linux/20 ...
- Ubuntu 12.04下安装QQ 2012 Beta3
Ubuntu 12.04下安装QQ 2012 Beta3 由于wine的发展非常迅速.现在网上的利用老版本的wine来安装QQ2012的教程已经有些过时了.实际上操作起来非常简单: 第一步:Ctr ...
- Ubuntu 12.04下安装OpenCV 2.4.2
http://sourceforge.net/projects/opencvlibrary/files/ Ubuntu 12.04下安装OpenCV 2.4.2 http://blog.csdn.ne ...
随机推荐
- oe7升级到oe8中import的使用
oe 7.0到oe 8.0 切换的时候发现我们系统的很多的module 无法load , import的时候出错, 后来发现oe 8.0自己的addons 也都做了修改在import自己的addon ...
- Walle代码发布系统
Walle 一个web部署系统工具,配置简单.功能完善.界面流畅.开箱即用!支持git.svn版本管理,支持各种web代码发布,PHP,Python,JAVA等代码的发布.回滚,可以通过web来一键完 ...
- 关于判断语句中如:while not xx: 或者:if not xx: 的含义及用法解析
关于判断语句中如:while not xx: 或者:if not xx: 的含义及用法解析 name='' while not name: name=raw_input(u'请输入姓名:') prin ...
- 程序的入口及AppDelegate窗体显示原理
AppDelegate.m - (void)dealloc { [_window release]; [super dealloc]; } - (BOOL)application:(UIApplica ...
- 新闻焦点切换flash应用
pixviewer.zip <!-- pixviewer.swf使用--> <script language="javascript" type="te ...
- spock spring 集成测试框架搭建心得
转载:http://blog.csdn.net/hankle_xu/article/details/77531880 spock测试框架,使用groovy作为脚本语言,开发出的测试脚本具有优良的阅读性 ...
- Firefly 流程架构
print '----startmaster------' 1print '----appmain------' 2 print '----netserver------' 3 print '---- ...
- STL源代码剖析 容器 stl_map.h
本文为senlie原创,转载请保留此地址:http://blog.csdn.net/zhengsenlie map ------------------------------------------ ...
- Spring-1 之入门
(一)简单对象Spring XML配置说明 使用Spring (Spring 3.0) 实现最简单的类映射以及引用,属性赋值: 1.1.新建类UserModel: 1 2 3 4 5 6 7 8 9 ...
- 一个简单的python爬虫(转)
# -*- coding: utf-8 -*- #--------------------------------------- # 程序:百度贴吧爬虫 # 版本:0.1 # 作者:why # 日期: ...