今天看到python使用的數據庫有個叫postgresql,就想用用試下。我的是ubuntu14.04的系統。
首先安裝postgresql:sudo apt-get install postgresql
然後創建‘postgres’的Linux用戶等等,另外還有一些配置信息網上都有。
在shell裏輸命令操作,首先切換到postgres用戶:su postgres
在創建用戶之前要切換到其它目錄,在/root目錄下創建用戶會得到權限不夠的錯誤。
創建用戶:createuser -s -P username; -s:創建supperuser -P:需要密碼驗證。需要改配置文件pg_hba.conf,具體在http://stackoverflow.com/questions/17443379/psql-fatal-peer-authentication-failed-for-user-dev有說明。
創建超級用戶是爲了導入.csv文件滿足權限要求。
參考網站:
http://blog.51yip.com/pgsql/1524.html
http://www.cnblogs.com/z-sm/archive/2016/07/05/5644165.html