Ubuntu server PostgreSQL安装以及基本操作
2016-09-10 15:45
561 查看
1. 安装:
sudo apt-get install postgresql
2.登录postgresql
sudo -u postgres psql 或者 su postgres
3.创建数据库
createdb 数据库名;
4.创建表:
如:
CREATE TABLE weather (
city varchar(80),
temp_lo int, -- low temperature
temp_hi int, -- high temperature
prcp real, -- precipitation
date date
);
向表中添加行:
如:
NSERT INTO weather VALUES ('beijing', 46, 50, 0.25, '1994-11-27');
5. 访问数据库:
psql 数据库名
6.其他:
\l -- 查看有哪些数据库
\q -- 退出
\c 数据库名 -- 从之前的库切换到 数据库名
\d table_name -- 查看表结构
\dt -- 查看有哪些表
\di -- 查看索引
\du -- 查看角色
OVER
sudo apt-get install postgresql
2.登录postgresql
sudo -u postgres psql 或者 su postgres
3.创建数据库
createdb 数据库名;
4.创建表:
如:
CREATE TABLE weather (
city varchar(80),
temp_lo int, -- low temperature
temp_hi int, -- high temperature
prcp real, -- precipitation
date date
);
向表中添加行:
如:
NSERT INTO weather VALUES ('beijing', 46, 50, 0.25, '1994-11-27');
5. 访问数据库:
psql 数据库名
6.其他:
\l -- 查看有哪些数据库
\q -- 退出
\c 数据库名 -- 从之前的库切换到 数据库名
\d table_name -- 查看表结构
\dt -- 查看有哪些表
\di -- 查看索引
\du -- 查看角色
OVER
相关文章推荐
- ubuntu server 安装mysql以及基本操作
- 在Ubuntu下安装Mongdb,以及Mongdb基本操作命令
- mac mysql-server 安装以及一些基本操作
- (转载)SoftIce的安装、配置以及一些基本操作
- ubuntu-server下apache安装配置以及优化
- ubuntu10.10server操作系统下安装RabbitMQ以及简单设置
- 【ubuntu】Ubuntu 安装postgreSQL以及图形界面pgadmin3,hstore
- ubuntu server基本操作
- ubuntu下mysql的安装以及基本命令
- Ubuntu10.10 Server+Nginx+Django+Postgresql安装步骤
- ubuntu安装postgresql,以及修改账户密码
- ubuntu server 12.04 安装postgresql 9.2
- ubuntu下面mysql数据库安装以及相关操作
- 我对ubuntu系统的一些感想(常见的安装软件方法以及基本知识)
- Ubuntu Server 12.10下安装以及配置Git
- 入门 --ubuntu下面mysql数据库安装以及相关操作
- Ubuntu server 11.04 安装memcache 以及使用memcache 来存储 session
- postgresql8.4在ubuntu9下的安装与基本配置
- Ubuntu 安装 PostgreSQL 和 python-psycopg2基础教程(以及错误解决)
- Ubuntu Server 12.04安装桌面环境以及配置VNC