<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "PostgreSQL同時開新帳號及資料庫的方法"]]></title>
		<link>https://forum.andowson.com/posts/list/12.page</link>
		<description><![CDATA[Latest messages posted in the topic "PostgreSQL同時開新帳號及資料庫的方法"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>PostgreSQL同時開新帳號及資料庫的方法</title>
				<description><![CDATA[ 將下面的程式儲存為/var/lib/pgsql/createdb.sh 
<br>
[code] 
<br>
psql -c "create user $1 createdb;" template1 
<br>
psql -c "create database $1 with encoding 'unicode';" -U $1 template1 
<br>
psql -c "alter user $1 nocreatedb;" template1 
<br>
psql -c "alter user $1 with encrypted password '$1';" template1 
<br>
[/code] 
<br>
然後將createdb.sh設定為可執行 
<br>
[code]chmod 755 createdb.sh[/code] 
<br>
後續要新增資料庫執行下面的指令即可 
<br>
[code]su - postgres 
<br>
./createdb.sh dbname[/code] 
<br>
會產生名稱為dbname的使用者，密碼也是dbname，而資料庫名稱也是dbname 
<br>]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/190/292.page</guid>
				<link>https://forum.andowson.com/posts/preList/190/292.page</link>
				<pubDate><![CDATA[Fri, 9 Nov 2007 09:40:58]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
	</channel>
</rss>