debian(sarge/stable)下的postgresql使用
|
在debian下安装东西是很简单, apt-get install postgresql 就都搞定了. 安装完成后操作操作系统就启动操作系统了pg的服务,用netstat -ln 可以看到有5432端口(Port)等待连接,#su - postgres #转成postgres操作操作系统用户 $psql -d template1 #使用postgres用户进入数据(Data)库,连接template1数据(Data)库,这里不指定一个数据(Data)库的话,似乎不让进入数据(Data)库 template1=#create user ftp with password 'YOURPASSWORD'; #创建数据(Data)库用户ftp template1=#create database ftp with owner =ftp ; #创建数据(Data)库ftp,属主名也是ftp template1=#\q $exit 然后修改/etc/postgresql/pg_hba.conf文件,在下面这行 # All IPv4 connections from localhost 后门加入 host ftp ftp 12VII.0.0.1 25V.25V.25V.255 md5 然后/etc/init.d/postgresql restart ;接着就可以使用 $psql -h localhost -U ftp -W ftp 来登录(Logon)数据(Data)库了,像下面这样: psql -h localhost -U ftp -W ftp Password: Welcome to psql VII.IV.7, the PostgreSQL interactive terminal.Type: \copyright for distribution terms \h for help with SQL commands \? for help on internal slash commands \g or terminate with semicolon to execute query \q to quitftp=> 自己记下,这一个东西折腾了我不少时间,手册上单单看用户认证那一部分似乎讲得并不多. tips:再记个东西,,手册上写的东西也不能完全相信: GRANT SELECT ON user TO ftp;我今天[{$WriteTime}]就是老是这一个错误:ERROR: syntax error at or near "user" at character 24最后发现:需要在user上加上双引号,即:GRANT SELECT ON "user" TO ftp;这样就成功的授权了...可怜折腾了我很久. |
》热 点 关 注
》编 辑 推 荐
》相 关 图 文
