zoukankan      html  css  js  c++  java
  • mac默认安装postgresql, 如何让postgresql可以远程访问

    mac默认安装postgresql, 如何让postgresql可以远程访问

    mac默认的postgresql目录的存放路径是/usr/local/var/postgres/ 在该目录下,修改两个文件,一个是postgresql.conf, 一个是pg_hba.conf,最后是重启

    修改postresql.conf

    listen_addresses = '*' # 修改这里的配置允许任意地址的链接postgresql

    修改pg_hba.conf

    host all all 0.0.0.0/0 trust # 配置服务端允许认证的方式

    重启postgresql

    brew services restart postgresql
    #启动服务也可以用 pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
    #停止服务 pg_ctl -D /usr/local/var/postgres stop -s -m fast
    #导入sql文件 psql -d database_name -f sql_file
    #导出pg_dump database_name > sql_file

    测试是否可以远程访问

    psql -U username -h ip -p port dbname
  • 相关阅读:
    FastAdmin 提示框 toastr 改变文字
    FastAdmin 将会员模块升级为基础模块的升级指导
    随笔
    随笔
    c++11 lambda(了解)
    c++11 类型推断
    boost::archive::text_oarchive
    std::ostringstream
    随笔
    随笔1
  • 原文地址:https://www.cnblogs.com/chenzhenzhen/p/8004354.html
Copyright © 2011-2022 走看看