Arch 安装和简单使用Postgresql

纵饮孤独 提交于 2019-11-26 18:35:27
$ sudo pacman -S postgresql
$ sudo /etc/rc.d/postgresql start
$ groups postgres
su root
su - postgres

详细解释看:https://wiki.archlinux.org/index.php/PostgreSQL_%28%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87%29

给postgresql射密码

$  su root
# passwd postgres

开始使用

# su postgres

建立数据库

createdb test;

进入数据库

psql test;

建一个叫cats的表:

test=# create table cats(name varchar(30), weight int);
CREATE TABLE

 查询:

test=# select * from cats;
  name   | weight 
---------+--------
 Leopard |     80
 cheetah |     50
(2 rows)

 

插入数据:

test=# insert into cats values('Leopard', 80);
INSERT 0 1

退出,帮助分别是:\h \q

 

 

转载于:https://www.cnblogs.com/Leo-Forest/archive/2012/07/02/2573856.html

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!