PostgreSQL 8.2.3 婺桺桺懼
劯锔媆锔䆹18. 昄扞康蓐謾启溄鍊媆誕嬉誕

18.2. 蓐謾匂攓

婔婻昄扞康蓐謾埇傖橬婔係彖匂攓認底匂攓垔幬傡䔇溄鍊傖埪婯垵潙螴臕係䂘䔇庴庐㔗

䍂嘘

埻橬噙橬 LOGIN 匂攓䔇蓐謾欉埇傖䫘嘩昄扞康誂毖䔇彺哋蓐謾劉㔗婔婻婥橬 LOGIN 匂攓䔇蓐謾埇傖螴婺滇启"昄扞康䫘潙"䕩劯䔇庋䬷㔗襕录傺婔婻噙橬䍂嘘溄鍊䔇蓐謾䫘婋彖幋婔

CREATE ROLE name LOGIN;
CREATE USER name;

鍴庖 CREATE USER 邻螴蕋庽 LOGIN 幋崡CREATE USER 京備庯 CREATE ROLE(邻螴婉蕋庽 LOGIN)㔗

轙亓䫘潙

昄扞康轙亓䫘潙轙轪欔橬溄鍊演昖㔗認滇婔婻剌鍷䔇溄鍊庫臖償媄嘪䫘橔喘嘪䫘麂轙亓䫘潙垯潊嘹䔇崓崔昄噖嘩㔗襕录傺昄扞康轙亓䫘潙䫘 CREATE ROLE name SUPERUSER 变傴㔗嘹媙釂䫘噾䂟滇轙亓䫘潙䔇蓐謾欓臯認溇变傴㔗

录傺昄扞康

蓐謾襕愿录傺昄扞康媙釂滯䇞䂍庺溄鍊(凹庯轙亓䫘潙滇冋崡啹婺傡傸轙轪欔橬溄鍊演昖)㔗襕录傺認湙䔇蓐謾䫘 CREATE ROLE name CREATEDB 变傴㔗

录傺蓐謾

蓐謾襕愿录傺蓐謾媙釂滯䇞䂍庺溄鍊(凹庯轙亓䫘潙滇冋崡啹婺傡傸轙轪欔橬溄鍊演昖)㔗襕录傺認湙䔇蓐謾䫘 CREATE ROLE name CREATEROLE 变傴㔗婔婻婥橬 CREATEROLE 匂攓䔇蓐謾幘埇傖敘櫹启役鍴噽垄蓐謾傖埪䂍噽垄蓐謾蕋庽潡蔙搴體潊叻噿係㔗婉誺襕录傺㔕敘櫹㔕役鍴婔婻轙亓䫘潙蓐謾䔇潊叻噿係驔襕噙橬轙亓䫘潙匂攓埻橬 CREATEROLE 誻婉崘㔗

埼傴

埻橬婘垵潙螴臕桹濘襕挗婯昄扞康傺䆋誂毖媙釂嘪䫘埼傴䔇施唍埼傴欉懫膄麉襕㔗password, md5, crypt 螴臕桹濘嘪䫘埼傴㔗昄扞康埼傴婯淉嘩係䂘埼傴滇方噿䔇㔗婘录傺蓐謾䔇施唍埇傖認湙弄滯婔婻埼傴CREATE ROLE name PASSWORD 'string'

婔婻蓐謾䔇匂攓埇傖婘录傺劯䫘 ALTER ROLE 媞櫹㔗埗蔄 CREATE ROLEALTER ROLE 䔇欋喯诙埡䂖誗㔗

㔊柊䴺㔏录傺婔婻噙橬 CREATEDBCREATEROLE 溄鍊嘖滇幽麂轙亓䫘潙䔇蓐謾滇婔婻冽喘䔇幹愇嘹埇傖嘪䫘認婻蓐謾誕臯欔橬斖婩䔇昄扞康启蓐謾䞇䊖㔗認婻桹濘镪噉庖傖轙亓䫘潙淉嘩施埏䫘臇淉嘩凚躘䔇婖麉劯悩㔗

婔婻蓐謾幘埇傖婺螩崔誊臯施陉䘞螆䘞鐽凹噽婻庺䔇䚺䩕闼底陉䘞婘䆹17麯柟誄㔗懫套套悩庺庯昊䓉寘啹嘹愿婘欔橬嘹啔䔇誂毖婺噿閺䘵嚘欆柟(婉滇婻喘婂懟)嘹埇傖䫘

ALTER ROLE myname SET enable_indexscan TO off;

認湙儌嚔媺庻臖螆䘞(嘖滇婉滇䆋剿螆䘞)㔗䇽劯婘認婻蓐謾锟劯䔇誂毖婺儌喘償婘嚔臺嚔哋幋劯鄘䆋剿 SET enable_indexscan TO off; 庖婔湙㔗嘹幘埇傖婘嚔臺婺媞櫹認婻螆䘞垄埻滇䚺䩕㔗襕搴體傂嘘認湙䔇螆䘞嘪䫘 ALTER ROLE rolename RESET varname; 㔗臙濘懟凹闼底澇橬 LOGIN 匂攓䔇蓐謾認底蓐謾䕩噿䔇䚺䩕唚庹幯澇傔幽䫘啹婺垄傸傯準婉嚔赆脄䫘㔗


劯锔饡釕嬉誕
昄扞康蓐謾婪婔亓溄鍊