tar xvf xxx ./configure make su make install adduser postgres mkdir /usr/local/pgsql/data chown postgres /usr/local/pgsql/data su - postgres /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 & /usr/local/pgsql/bin/createdb test /usr/local/pgsql/bin/psql test
设置pgsql必须密码登录
1 2 3 4
vim pg_hba.conf #host all all 127.0.0.1/32 trust host all all 127.0.0.1/32 passowrd
一些基本命令
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#创建用户 create user hbyc with password'LQ123er48vzz'; #创建数据库 create database ychbV1 with encoding='utf8' owner=hbyc; #授权 grant all privileges on database ychbV1 to hbyc; #登录 psql -Upostgres -dtest -h127.0.0.1 #查看已有数据库 \l #查看表 \dt #导入sql文件 psql -d ychbv1 -Uhbyc -h127.0.0.1 -f ychb.sql #修改用户密码 alter user postgres with password'U5123ewqyjEi5'; #设置密码 \password postgres