zoukankan      html  css  js  c++  java
  • PostgreSQL配置

     摘要

    PostgreSQL配置

    1、配置监听

    -bash-4.2$ cd $PGDATA
    -bash-4.2$ ls
    base              pg_commit_ts   pg_logical    pg_serial     pg_subtrans  pg_wal                postmaster.opts
    current_logfiles  pg_dynshmem    pg_multixact  pg_snapshots  pg_tblspc    pg_xact               postmaster.pid
    global            pg_hba.conf    pg_notify     pg_stat       pg_twophase  postgresql.auto.conf
    log               pg_ident.conf  pg_replslot   pg_stat_tmp   PG_VERSION   postgresql.conf
    
    -bash-4.2$ cp postgresql.conf postgresql.conf.bak
    -bash-4.2$ vi postgresql.conf 
    
    listen_addresses = '*'  #监听所有ip

     数据库连接

    -bash-4.2$ cp pg_hba.conf pg_hba.conf.bak
    -bash-4.2$ vi pg_hba.conf
    host    all             all             0.0.0.0/0               md5

    多行参数生效顺序:由上到下

    参数详解


    查看数据库
    -bash-4.2$ psql -l
                                      List of databases
       Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
    -----------+----------+----------+-------------+-------------+-----------------------
     postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
     template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
               |          |          |             |             | postgres=CTc/postgres
     template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
               |          |          |             |             | postgres=CTc/postgres
    (3 rows)

    连接数据库

    -bash-4.2$  psql -dpostgres
    postgres=# h 可以查找命令
    postgres=# ?

    创建数据库

    postgres=# create table test(id int);
    CREATE TABLE
    postgres=# dt
            List of relations
     Schema | Name | Type  |  Owner   
    --------+------+-------+----------
     public | test | table | postgres
    (1 row)

    修改密码

    postgres=# alter user postgres with password 'postgres';



  • 相关阅读:
    关于String重写的hashcode的代码分析
    自定义HashSet判重标准
    idea-Java文件结构
    java 带静态域的导出类创建时都发生了什么?
    seo初学
    关于事件冒泡和事件委托
    关于本地$.get(url,function(data)),异步获取数据
    FileReader上传图片
    关于随机生成颜色
    C语言贪吃蛇
  • 原文地址:https://www.cnblogs.com/connected/p/12635678.html
Copyright © 2011-2022 走看看