Django学习记录(三)
postgresql 的配置
安装postgresql在前面已经有了,再安装和python的接口包psycopg2,也在前面写了
psql (PostgreSQL) 8.4.18
我操作如下
service postgresql initdb
service postgresql start
su - postgres
psql
postgres=#\password postgres #设置postgres的密码
createuser dbuser
Shall the new role be a superuser? (y/n) y
psql
postgres=#\password dbuser
createdb mydb -O dbuser
exit
vim /var/lib/pgsql/data/pg_hba.conf #修改一下
cat /var/lib/pgsql/data/pg_hba.conf
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
psql -U dbuser -d mydb -h 127.0.0.1 -p 5432
/etc/init.d/postgresql reload
psql -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

浙公网安备 33010602011771号