sudo apt-get install python-software-properties
sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get update
sudo apt-get install postgresql-9.2
安装完毕后修改数据库的默认用户postgres的密码
sudo -u postgres psql
ALTER USER postgres WITH PASSWORD ‘postgres’;
\q //退出
修改linux系统的postgres用户的密码,先清空该用户的密码
sudo passwd -d postgres
sudo -u postgres passwd
修改配置文件
vi /etc/postgresql/9.2/main/postgresql.conf
#listen_addresses = ‘localhost’改为 listen_addresses = ‘*’
#password_encryption = on改为password_encryption = on
vi /etc/postgresql/9.2/main/pg_hba.conf
添加 host all all 0.0.0.0 0.0.0.0 md5
最后重启 /etc/init.d/postgresql restart
接下来就可以登录操作了
psql -U postgres -h 127.0.0.1
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9521459/viewspace-759918/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9521459/viewspace-759918/