• PostgreSQL


    PostgreSQL是一种关系型数据库管理系统 (RDBMS)

    配置文件目录
    /var/lib/pgsql/9.3/data

    配置文件
    [root@b11 data]# grep '^listen' postgresql.conf
    listen_addresses = '
    ' # what IP address(es) to listen on;

    [root@b11 data]# grep '[1]' pg_hba.conf
    local all all trust
    host all all 127.0.0.1/32 trust
    host all all 0.0.0.0/0 trust

    日志目录
    /var/lib/pgsql/9.3/data/pg_log

    启动
    [root@b11 data]# systemctl start postgresql-9.3.service

    查看端口
    [root@b11 pg_log]# ss -lntup|grep 5432
    tcp LISTEN 0 128 :5432 : users:(("postgres",pid=21467,fd=3))
    tcp LISTEN 0 128 :::5432 :::
    users:(("postgres",pid=21467,fd=4))

    查看进程
    [root@b11 pg_log]# ps -ef|grep postgres
    postgres 21467 1 0 10:10 ? 00:00:00 /usr/pgsql-9.3/bin/postgres -D /var/lib/pgsql/9.3/data
    postgres 21468 21467 0 10:10 ? 00:00:00 postgres: logger process
    postgres 21470 21467 0 10:10 ? 00:00:00 postgres: checkpointer process
    postgres 21471 21467 0 10:10 ? 00:00:00 postgres: writer process
    postgres 21472 21467 0 10:10 ? 00:00:00 postgres: wal writer process
    postgres 21473 21467 0 10:10 ? 00:00:00 postgres: autovacuum launcher process
    postgres 21474 21467 0 10:10 ? 00:00:00 postgres: stats collector process
    root 22066 21013 0 10:28 pts/1 00:00:00 grep --color=auto postgres
    [root@b11 pg_log]#

    [root@b11 9.3]#useradd postgres
    [root@b11 9.3]#passwd postgres
    123456

    [root@b11 9.3]# su postgres
    bash-4.2$ /usr/pgsql-9.3/bin/createdb test #创建数据库
    bash-4.2$ /usr/pgsql-9.3/bin/psql test #激活数据库
    psql (9.3.20)
    Type "help" for help.
    test=# select version();
    version

    PostgreSQL 9.3.20 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16), 64-bit
    (1 row)

    test=# select current_date;
    date

    2017-11-27
    (1 row)

    test=# select 2+2;
    ?column?

        4
    

    (1 row)

    test=#

    测试本地连接

    [root@b11 data]# /usr/pgsql-9.3/bin/psql -h 127.0.0.1 -d test -U postgres -p 5432
    psql (9.3.20)
    Type "help" for help.

    test=# select version();
    version



    PostgreSQL 9.3.20 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat
    4.8.5-16), 64-bit
    (1 row)

    test=#

    查看帮助

    test=# h

    退出

    test=# q


    1. a-z ↩︎

  • 相关阅读:
    建模算法(九)——拟合 (转)
    Swift初探一
    D3DXMatrixMultiply 函数
    魔术师发牌和拉丁方阵
    strip 命令的使用方法
    GDI编程小结
    Android多媒体-MediaRecorder 录制音视频
    Android 使用Gson解析json案例具体解释
    有依赖的背包问题(背包九讲)
    c++ 正則表達式
  • 原文地址:https://www.cnblogs.com/fengmeng1030/p/8435373.html
Copyright © 2020-2023  润新知