`
javatgo
  • 浏览: 1119857 次
  • 性别: Icon_minigender_2
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

初识linux下postgresql数据库并且简单使用(原创)

阅读更多

rpm -Uvh --nodeps 'ls'
安装下列列出的rpm……

rpm -qa|grep postgre
查看所有相关于postgre的安装包所安装后的文件目录……

service postgresql start
启动postgresql服务

#su postgres 用postgres用户权限登陆


bash-2.05b$createdb 建立数据库

bash-2.05b$psql


*********************************
Welcome to psql 7.3.4, the Postgresql interactive terminal
*********************************

bashv-2.05$vi /var/lib/pgsql/data/postgresql.conf

编辑postgresql配置文件

vi /var/lib/pgsql/data/pg_hba.conf
查看远端访问限制,如果需要远端机器连接和操纵本地数据库,就需要加入远端IP地址和子网掩码……

建立用户
CREATE USER RootHackComputerInt WITH PASSWORD 'RootHackComputerInt';


建立一个RootHackComputerInt拥有的数据库
CREATE DATABASE RootHackComputerInt WITH OWNER = netkiller TEMPLATE = template0

ENCODING='UNICODE';/**(编码为UNICODE)*/

#\duList of database users

#\lList of databases


#\qexit the postgresql(psql)


hash-2.0.5b$ createlang plpgsql netkiller(/**?????*/)


[root@linux software]# service postgersql restart


[root@linux software]#psql -h127.0.0.1 -URootHackComputerInt RootHackComputerInt
password:*********
用帐户 RootHackComputerInt密码RootHackComputerInt登陆…………

********************************************************
Welcome to psql 7.3.4,the PostgreSQL interactive terminal.
************************************************************

postgres 只能用于UNIX Domain Socket 方式登陆(/tmp/.s.PGSQL.5432)
不能在TCP/IP Socket模式下登陆

ls -la /tmp

file /tmp/.s.PGSQL.5432
查看文件类型,所以/tmp/.s.PGSQL.5432显示类型为/tmp/.s.PGSQL.5432:socket

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics