¡¡¡¡ÔÚdebianϰ²×°¶«Î÷ÊǺܼòµ¥£¬ apt-get install postgresql ¾Í¶¼¸ã¶¨ÁË¡£
¡¡¡¡°²×°Íê³Éºóϵͳ¾ÍÆô¶¯ÁËpgµÄ·þÎñ£¬ÓÃnetstat -ln ¿ÉÒÔ¿´µ½ÓÐ5432¶Ë¿ÚµÈ´ýÁ¬½Ó£¬
#su - postgres #ת³ÉpostgresϵͳÓû§
$psql -d template1 #ʹÓÃpostgresÓû§½øÈëÊý¾Ý¿â£¬Á¬½Ótemplate1Êý¾Ý¿â£¬ÕâÀï²»Ö¸¶¨Ò»¸öÊý¾Ý¿âµÄ»°£¬Ëƺõ²»ÈýøÈëÊý¾Ý¿â
template1=#create user ftp with password 'YOURPASSWORD'; #´´½¨Êý¾Ý¿âÓû§ftp
template1=#create database ftp with owner = ftp ; #´´½¨Êý¾Ý¿âftp£¬ÊôÖ÷ÃûÒ²ÊÇftp
template1=#\q
$exit
È»ºóÐÞ¸Ä/etc/postgresql/pg_hba.confÎļþ£¬ÔÚÏÂÃæÕâÐÐ
# All IPv4 connections from localhost
ºóÃżÓÈë
host ftp ftp 127.0.0.1 255.255.255.255 md5
È»ºó/etc/init.d/postgresql restart ;½ÓמͿÉÒÔʹÓÃ
$psql -h localhost -U ftp -W ftp
À´µÇ¼Êý¾Ý¿âÁË£¬ÏóÏÂÃæÕâÑù£º
psql -h localhost -U ftp -W ftp
Password:
Welcome to psql 7.4.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 quit
ftp=>
¡¡¡¡×Ô¼º¼ÇÏ£¬Õâ¸ö¶«Î÷ÕÛÌÚÁËÎÒ²»ÉÙʱ¼ä£¬ÊÖ²áÉϵ¥µ¥¿´Óû§ÈÏÖ¤ÄÇÒ»²¿·ÖËÆºõ½²µÃ²¢²»¶à¡£
¡¡¡¡tips:ÔټǸö¶«Î÷£¬£¬ÊÖ²áÉÏдµÄ¶«Î÷Ò²²»ÄÜÍêÈ«ÏàÐÅ£º
¡¡¡¡GRANT SELECT ON user TO ftp;ÎÒ½ñÌì¾ÍÊÇÀÏÊÇÕâ¸ö´íÎó£ºERROR: syntax error at or near "user" at character 24×îºó·¢ÏÖ£ºÐèÒªÔÚuserÉϼÓÉÏË«ÒýºÅ£¬¼´£ºGRANT SELECT ON "user" TO ftp;ÕâÑù¾Í³É¹¦µÄÊÚȨÁË¡£¡£¡£¿ÉÁ¯ÕÛÌÚÁËÎҺܾá£

