Huli's Blog

Learning by sharing

postgresql 管理

| Comments

在postgresql裝好以後,先來設定一下使用者

首先先用postgres
su - postgres

再來建立使用者
createuser

可用\du看到使用者名單
可用ALTER USER Postgres WITH PASSWORD '<newpassword>';建立密碼

然後來建db
psql
CREATE DATABASE db_name;
\l

建db前可參考這篇把模板改成自己想要的編碼

後來我在自己電腦連server連不上,發現是設定的一些問題
可參考 這篇
設定檔在 /var/lib/pgsql/data/pg_hba.conf
ident換成password
改完以後記得 service postgresql restart
然後就可以利用你剛建好的帳號跟密碼登進去遠端的db了

ALTER DATABASE db_name OWNER TO huli; 可更改某db的owner

How To Install and Use PostgreSQL on a CentOS VPS
How To Use Roles and Manage Grant Permissions in PostgreSQL on a VPS
在 RHEL/CENTOS 6 Debian Linux 上使用 PostgreSQL資料庫
Copying PostgreSQL database to another server
http://www.revsys.com/writings/postgresql/errors.html

Comments

comments powered by Disqus