Django学习记录(三)

来源:互联网 发布:淘宝内部优惠券的软件 编辑:程序博客网 时间:2024/05/30 04:30

postgresql 的配置

安装postgresql在前面已经有了,再安装和python的接口包psycopg2,也在前面写了

psql (PostgreSQL) 8.4.18

我操作如下

service postgresql initdbservice postgresql startsu - postgrespsqlpostgres=#\password postgres        #设置postgres的密码 createuser  dbuser  Shall the new role be a superuser? (y/n) ypsqlpostgres=#\password dbusercreatedb mydb -O dbuserexitvim /var/lib/pgsql/data/pg_hba.conf   #修改一下cat  /var/lib/pgsql/data/pg_hba.conf local   all         all                               trusthost    all         all         127.0.0.1/32          trusthost    all         all         ::1/128               trust psql  -U dbuser -d mydb -h 127.0.0.1 -p 5432/etc/init.d/postgresql reloadpsql  -U dbuser -d mydb -h 127.0.0.1 -p 5432


这样我们就创建一个数据库用户dbuser,他的数据库是mydb

如下为参考:

 

http://www.cnblogs.com/terrysun/archive/2012/11/30/2796479.html

http://jingyan.baidu.com/article/3ea51489ec3cb452e71bba52.html

http://stackoverflow.com/questions/2942485/psql-fatal-ident-authentication-failed-for-user-postgres

0 0
原创粉丝点击