【环境配置】Mac PostgreSQL 初始化出错



  • 环境说明

    • Mac 10.11.16
    • postgreSQL : 9.5.4_1 (brew install 安装)

    问题描述

    终端输入 initdb /usr/local/var/postgres -E utf8 ,有以下出错信息:

    initdb: directory “/usr/local/var/postgres” exists but is not empty
    If you want to create a new database system, either remove or empty
    the directory “/usr/local/var/postgres” or run initdb
    with an argument other than “/usr/local/var/postgres”.

    是否需要按照 http://www.tgreenidge.com/blog/installing-postgres 执行以下操作

    Remove old database files

    rm -r /usr/local/var/postgres

    Run the initdb command again

    initdb /usr/local/var/postgres


  • 太阁x英雄榜

    @awesome_zero【环境配置】Mac PostgreSQL 初始化出错 中说:

    initdb: directory “/usr/local/var/postgres” exists but is not empty
    If you want to create a new database system, either remove or empty
    the directory “/usr/local/var/postgres” or run initdb
    with an argument other than “/usr/local/var/postgres”.

    @awesome_zero 你好,感谢你的提问!

    其实你已经自问自答了哈 -

    对的,按照您给出的两个command就可以解决该问题。

    给problem-solving能力点赞!=)

    • Remove old database files
    rm -r /usr/local/var/postgres
    
    • Run the initdb command again
    initdb /usr/local/var/postgres
    


  • @shirleyrz

    好的,谢谢。之前问题已解决,但重新运行 initdb /usr/local/var/postgres -E utf8,出现以下结果警告信息,不清楚是否会影响本次项目

    The database cluster will be initialized with locale “zh_CN.UTF-8”.
    initdb: could not find suitable text search configuration for locale "zh_CN.UTF-8"
    The default text search configuration will be set to “simple”.

    WARNING: enabling “trust” authentication for local connections
    You can change this by editing pg_hba.conf or using the option -A, or
    –auth-local and --auth-host, the next time you run initdb.


 

与 BitTiger Community 的连接断开,我们正在尝试重连,请耐心等待