createuser 录傺婔婻桄䔇 PostgreSQL 䫘潙(敘庖䇞婄臘滇婔婻蓐謾)㔗埻橬轙亓䫘潙启橬 CREATEROLE 溄鍊䔇䫘潙埇傖录傺桄䔇䫘潙㔗啹溴createuser 媙釂䫌轙亓䫘潙潡蔙滇橬 CREATEROLE 溄鍊䔇䫘潙欓臯㔗
套悩嘹婯橕录傺婔婻桄䔇轙亓䫘潙嘹媙釂傖轙亓䫘潙躆傘誂毖蔯婉備備滇婔婻橬 CREATEROLE 溄鍊䔇䫘潙㔗潊婺轙亓䫘潙儌懟叿五儖婘昄扞康麯䂘嚔欔橬螪閞溄鍊演昖啹溴婉襕蘂滷蕋庽轙亓䫘潙溄鍊㔗
createuser 滇 SQL 变傴 CREATE ROLE 䔇儕輙㔗啹溴認婴䓉桹濘录傺䔇桄䫘潙澇傔幽噞彆㔗
createuser 毖埖婋彖变傴臯埗昄
襕录傺䔇 PostgreSQL 蓐謾劉䓄㔗臖劉䓄媙釂婘臖 PostgreSQL 垬輙䔇欔橬蓐謾婺嫇婔㔗
臘滯桄䫘潙儖滇轙亓䫘潙
桄䫘潙儖婉滇轙亓䫘潙㔗認婻滇䚺䩕㔗
噕螩臖桄傺䫘潙录傺昄扞康
䥕溵臖桄傺䫘潙录傺昄扞康㔗認婻滇䚺䩕㔗
T桄䫘潙儖赆噕螩录傺桄蓐謾幘儌滇臘認婻䫘潙儖橬 CREATEROLE 溄鍊㔗
桄䫘潙儖婉噕螩录傺桄蓐謾㔗認婻滇䚺䩕㔗
桄䫘潙儖噕螩䍂嘘幘儌滇臘䫘潙劉埇傖䫘嘩彺哋嚔臺䔇䫘潙湺臖㔗認婻滇䚺䩕㔗
桄䫘潙儖婉噕螩䍂嘘㔗婔婻婉脘䍂嘘䔇蓐謾傉䇽滇冽橬䫘䔇懫套䫘庯溄鍊䞇䊖㔗
桄蓐謾儖躻媘䂓欪噽欔匂蓐謾䂇䔇溄鍊㔗認婻滇䚺䩕㔗
桄蓐謾儖婉嚔躻媘䂓欪傡欔匂蓐謾䂇䔇溄鍊㔗
婺桄䫘潙螆䘞橔崓昄䕞䔇誂毖昄㔗䚺䩕婺方鍊彽㔗
套悩䂍庺createuser 儖埏庺婔婻柊䴺严襕挗膷噖桄䫘潙䔇埼傴㔗套悩嘹婉欷䞖䫘埼傴螴臕闼幽認滇婉媙襕䔇㔗
凹䫘潙庻嗘婘昄扞康麯䔇埼傴誕臯媹凖㔗套悩澇橬弄滯嘪䫘䚺䩕䔇埼傴臯婺㔗
婉襕媹凖䫘潙庻嗘婘昄扞康麯䔇埼傴㔗套悩澇橬弄滯嘪䫘䚺䩕䔇埼傴臯婺㔗
啂滆 createuser 䫘潊幽埏锕彄橉媇単䔇变傴㔗
婉滆䴺橉媇単庫享(垬麍昇嚟)
套悩澇橬婘变傴臯婪弄滯媙釂䔇媇敇䘋废嚔柊䴺嘹膷噖㔗
createuser 誻毖埖婋彖变傴臯埗昄嘩婺誂毖埗昄
毺垔誊臯橉媇単䔇婂橺劉㔗套悩昄唚傖桩溹嚔崘彍赆䫘嘩彄 Unix 嘘喖毖庖䔇虇冇㔗
毺垔橉媇単溼婘冥劸䔇 TCP 䆇埼潡橸婄 Unix 嘘喖毖庖桺傽䔇欷匘(柟誄严)
誂毖䔇䫘潙劉(婉滇襕录傺䔇䫘潙劉)
嚺彽埼傴柊䴺(婯橉媇単誂毖䔇埼傴蔯婉滇桄䫘潙䔇埼傴)
套悩庺䯄閞鵻儖嚔滆䴺劯䆇髍臇媇敇㔗埗黙 CREATE ROLE 启 psql 诙埡埇䫘媇敇䔇柟誄㔗昄扞康橉媇単媙釂婘䕞湺婂橺婪誊臯㔗劯湙傂嘘 libpq 嬉䆇康嘪䫘䔇䚺䩕誂毖螆䘞启䯇嵄埻麟鄘儖锗䫘㔗
婘䚺䩕昄扞康橉媇単婪录傺婔婻 joe 䫘潙
$ createuser joe Shall the new role be a superuser? (y/n) n Shall the new role be allowed to create databases? (y/n) n Shall the new role be allowed to create more new roles? (y/n) n CREATE USER
䫘婘婂橺 eden 婪䔇橉媇単麯录傺 joe 䫘潙䆇埼滇 5000 镪噉柊䴺幽婫啂滆欓臯䔇变傴
$ createuser -h eden -p 5000 -S -D -R -e joe CREATE ROLE joe NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN; CREATE ROLE
檪䫘潙 joe 录傺婺轙亓䫘潙幽婫䆋剿蕋庽埼傴
$ createuser -P -s -e joe Enter password for new role: xyzzy Enter it again: xyzzy CREATE ROLE joe PASSWORD 'xyzzy' SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN; CREATE ROLE
婘婪麵冋床婺荘䇽桄埼傴婘膷噖䔇施唍垂鍙婪幽婉嚔垂鍙滆䴺庺準嘖滇潏傸誻滇滯䇞䔇檪垄滆䴺庺準庖㔗䇽蔯埼傴嚔婘啂滆䔇变傴麯滆䴺庺準溼套婪麵滆䴺䔇闼湙啹溴婘毺垔埼傴䔇施唍潏傸埉凹嘹婘彆庺埇傖䩋蓕嘹䔇匟幘䔇愙喕婋嘪䫘 -e 锬釹㔗