Skip to content

Instantly share code, notes, and snippets.

@codeachange
Last active October 18, 2017 16:21
Show Gist options
  • Save codeachange/fee7ace063cfea950abe93c39b90a118 to your computer and use it in GitHub Desktop.
Save codeachange/fee7ace063cfea950abe93c39b90a118 to your computer and use it in GitHub Desktop.
# 安装
yum install postgresql-server postgresql-contrib
# 初始化
postgresql-setup initdb
# ident 改为 md5,ident是使用系统账号验证; md5使用单独的数据库账号
vi /var/lib/pgsql/data/pg_hba.conf
# 开机启动
systemctl start postgresql
systemctl enable postgresql
# 进入命令行
sudo -i -u postgres
psql
# type \q to quit
# 数据库操作(进入psql之后)
\l # 数据库列表
create database db_name; # 创建数据库
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment