ubuntu安装postgresql和使用方法
来源:互联网 发布:银行承兑汇票 知乎 编辑:程序博客网 时间:2024/05/18 01:13
安装组件
客户端安装
sudo apt-get install postgresql-client
服务器安装
复制代码
代码如下:sudo apt-get install postgresql postgresql-contrib
获取Installing PostGIS, procedural languages, client interfaces等插件列表
复制代码
代码如下:apt-cache search postgres
Ruby PG gem安装,需要生成Native Extension
首先安装相应package
复制代码
代码如下:sudo apt-get install libpq-dev
找到pg_config所在位置
复制代码
代码如下:sudo find / -name pg_config
安装pg gem
复制代码
代码如下:gem install pg -- --with-pg-config=/usr/bin/pg_config
服务器配置
设置postgres用户,用postgres用户登录并修改密码
复制代码
代码如下:sudo -u postgres psql postgres
为postgres用户设置密码
复制代码
代码如下:\password postgres
创建新数据库
复制代码
代码如下:sudo -u postgres createdb mydb
服务器高级设置
创建用户
复制代码
代码如下:sudo -u postgres createuser --superuser $USER
sudo -u postgres psql
postgres=# \password $USER
管理用户及权限
编辑/etc/postgresql/current/main/postgresql.conf文件用以监听其它网络
复制代码
代码如下:listen_addresses = '*'
创建新用户tesdb及该用户所拥有的数据库testdb
复制代码
代码如下:sudo -u postgres createuser -D -A -P testdb
sudo -u postgres createdb -O testdb testdb
编辑/etc/postgresql/current/main/pg_hba.conf文件,允许testdb用户远程连接testdb数据库
复制代码
代码如下:host testdb testdb 0.0.0.0/0 md5
重新加载配置
复制代码
代码如下:sudo /etc/init.d/postgresql reload
重启数据库
复制代码
代码如下:sudo /etc/init.d/postgresql restart
0 1
- ubuntu安装postgresql和使用方法
- ubuntu安装postgresql和使用方法
- ubuntu- PostgreSQL安装和卸载
- ubuntu- PostgreSQL安装和卸载
- Ubuntu 安装和配置postgresql
- Ubuntu PostgreSQL安装和配置
- Ubuntu PostgreSQL安装和配置
- Ubuntu下安装和配置PostgreSQL 8.1
- 在Ubuntu下安装Postgresql和pgAdmin3
- ubuntu中PostgreSQL使用方法详解
- ubuntu下安装postgresql
- 在ubuntu安装PostgreSQL
- ubuntu 安装Postgresql/Pgadmin3
- ubuntu安装PostgreSQL
- ubuntu安装配置postgreSQL
- ubuntu安装数据库postgresql
- ubuntu下安装postgresql
- Ubuntu安装Postgresql
- Java 并发工具包 java.util.concurrent 用户指南
- string与double的互相转换
- JavaWeb的编码问题
- python进阶之路---环境安装
- 字符串和C预处理的一些注意事项
- ubuntu安装postgresql和使用方法
- 洛谷P2661 信息传递
- C++ Mat 读取imagedata内的数据
- Go - 基础知识三
- 【札记】CentOS7-linux-在虚拟机上配置IP地址
- python virtualenv
- +的用法
- js数组常用方法
- 高仿映客直播点亮功能,VectorDrawable+PropertyAnimation实战篇